First post here.
I'm building and automatic trading system (ATS) and have a spreadsheet which lists the trades taken based on a set of trading rules. An equity curve is also generated which sometimes shows long periods of wins and losses (on average). I only want to trade when the equity curve is rising. The format of the spreadsheet looks like this:
Trade # Type Net Profit - *** NP
1 Buy ($25.00)
Sell ($25.00)
2 Buy $112.50
Sell $87.50
3 Buy $12.50
Sell $100.00
4 Sell Short $0.00
Buy to Cover $100.00
5 Sell Short ($37.50)
Buy to Cover $62.50
6 Buy $0.00
Sell $62.50
7 Sell Short ($25.00)
Buy to Cover $37.50
Now I want to calculate the average of the *** profit over the last X trades. But, as you can see the *** profit is listed on every other line. So I guess I need some way to make this calculation but skip the input value every other line.
Now part 2 is performing a check to see if the line connecting this rolling average is positive or negative. If its negative, then stop trading, and don't add the net profit for the trades to the ***. profit until the slope turns positive again.
I've attached a picture of the equity curve for reference.
I'm getting stuck on how to calculate an average on a Column of numbers, but skipping every other row. I can't change the formate of what's initially give to me above. Any help is appreciated.
Thanks in advance.
Bookmarks