Im working on a strategy that has a daily profit target and daily loss but I cant get it to work when I back test it. it works fine when I live sim trade it.
When I back test it, it makes the profit target but then stops trading for the rest of the year.
Here is the code
if (Position.MarketPosition == MarketPosition.Flat) // Only calculate when position is flat
{
if (Bars.FirstBarOfSession)
{
cumprofit = Performance.AllTrades.TradesPerformance.Currency.CumProfit; // Calculate the cumprofit all strategy days
todaysPL = Performance.AllTrades.TradesPerformance.Currency.CumProfit - cumprofit; // Reset todays P&L
PrintWithTimeStamp("FirstBarOfSession!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
}