I am trying to backtest a strategy but only make one trade per day. I found the following post:
and used the following code:
OnBarUpdate()
{
if (CurrentBar < 2) return;
if (Time[0].DayOfWeek != Time[1].DayOfWeek) // new day, reset bool flag
{ alreadyTradedToday = false; }
if ([Long Entry Conditions are true] && alreadyTradedToday == false)
{
alreadyTradedToday = true;
EnterLong();
}
}
Thanks.

Comment