[I posted this on another post I found about a similar issue but it was outdated without a response so started a new one here. I have searched and saw this issue come up a lot but did not find an exact answer anywhere]
Request: I am looking to reset the max daily trade count in my ninjascript editor strategy.
Other Info: The counter itself is working as intended, and limiting to max 3 trades as it should, but in backtest it only shows it for the first day where it encounters this max 3 trades condition.
Current Script
I use the following script to attempt to reset:
bool newDay = Bars.IsFirstBarOfSession;
if (newDay == true)
{
totalTradesToday = 0;
}
Problem: But it does not seem to take. Is this an issue where this function doesn't work in Backtest and Optimization? It seems like it is working properly and printing the correct values. But then it won't reset on a new day
In summary, my end goal is to limit my script to 3 trades per day. My strategy's biggest losses are when it takes more trades than that per day.
Sure, I could do this manually. But what I am trying to do is run the Optimization to see the best parameters if I have this max 3 trades per day in place.
Any help is appreciated.
Thank you!
Steve

Comment