My novice ignorance will be showing here. Having written out a spreadsheet that uses raw stock price data, generates a couple indices and then based upon the indicators generates a "Long" or "Short" signal. While I have that in one column (of either Long or Short) as well as another column that only lists it as "Buy" or "Sell" only when the signal changes, There are a lot of empty cells in the later column. I'd like to consolidate it into a table that lists for each Buy signal, the next signal (which is a Sell by the column) and appropriate dates and prices. Here's an example demo table of what the main sheet looks like:
What I am after is something like this:
I have tried a variety of LOOKUP functions, that haven't worked. I am happy to experiment and will keep trying, but was hoping someone might have a suggested solution or at least a direction to try. Suspect it's obvious to some, but totally escapes me. Any help appreciated.
Lakedog
Date | Price | Indicator1 | Indicator2 | Signal | Buy/Sell |
Date1 | Price1 | XX | YY | Short | |
Date2 | Price2 | XX | YY | Long | Buy |
Date3 | Price3 | XX | YY | Long | |
Date4 | Price4 | XX | YY | Long | |
Date5 | Price5 | XX | YY | Short | Sell |
Date6 | Price6 | XX | YY | Short | |
Date7 | Price7 | XX | YY | Long | Buy |
Date8 | Pirce8 | XX | YY | Long | |
Date9 | Price9 | XX | YY | Long | |
Date10 | Price10 | XX | YY | Short | Sell |
What I am after is something like this:
Trade | BuyDate | Entry Price | SellDate | Exit Price | P/L | |
1 | Date2 | Price2 | Date5 | Price5 | =(Price5-Price2) | |
2 | Date7 | Price7 | Date10 | Price10 | etc | |
3 | ||||||
4 | ||||||
5 |
I have tried a variety of LOOKUP functions, that haven't worked. I am happy to experiment and will keep trying, but was hoping someone might have a suggested solution or at least a direction to try. Suspect it's obvious to some, but totally escapes me. Any help appreciated.
Lakedog