Column B is the lowest price which happened at the time as indicated in column C. Similarly column D is the highest price which happened at the time as indicated in column E.
Let's say we have a long term strategy giving buying and selling suggestions at certain predetermined prices each year, as in columns F and G, which may or may not be reached in reality. Column H and I denote whether the suggested prices are reached or not.
Now in order to test the performance of such strategy, we have column J which calculates the winning or losing percentage whenever a selling is done. Since it's actually bought at F2 and sold at G2 (with the valid chronology of E2>C2), J2 is calculated by G2/F2-1.
At F3 it's bought again. G3 isn't reached thus it's not sold then. At F4 it suggests buying again but we already bought so there's no effect. At G4 we reach the suggested price and sell it. Thus the outcome is calculated at J4.
Similarly the next buying happens at F5 and the next selling happens at G6, resulting in J6. At G7 it's suggested to sell but we have no stocks to sell. Note that G7 happens before F7 as deduced from the high/low dates (E7<C7). The price of F7 is reached but we don't have a valid selling until now so there's no complete trade to be calculated for this single buying.
We need a formula for J2:J8 (as well as other sets of data arranged in a similar manner) to automatically calculate this. Any help would be very much appreciated!
Bookmarks