I am testing a FX strategy with an exit after a certain profit. The code works fine if I define the profit in percent or currency. But if I set the PerformanceUnit to points, the strategy fails to exit at the correct moment. How can I fix this?
Code with currency
if (Performance.AllTrades.TradesPerformance.Currency.CumProfit + Position.GetProfitLoss(Close[0], PerformanceUnit.Currency) >= Profit) { ExitLong("", ""); ExitShort("", ""); }
if (Performance.AllTrades.TradesPerformance.Points.CumProfit + Position.GetProfitLoss(Close[0], PerformanceUnit.Points) >= Profit) { ExitLong("", ""); ExitShort("", ""); }
Comment