Im trying to tally the profit/loss from each trade within backtesting for position sizing purposes. The code below is what i have found on the forum, however i noticed that this only provides the last tposition that has been fully closed. I am sclaing out of my position and i would like to retreive the last partially closed trade profit/loss. Just like you would see in the Trades Tab of the Strategy Analyzer. I would of expected the trade number in the trades list would be the last trade trade. This doesn't appear to be the case. Can someone help me out with this?
Trade lastTrade = SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1]; // Calculate the PnL for the last completed real-time trade double lastProfit = lastTrade.ProfitCurrency;
Comment