I just found something out on my strategy. If I use try and catch on my strategy, that it actually alters the code. I ran the strategy with try and catch code in there. I got 14,000 trades. I only put "//" in front of the try and catch code with no other changes and then ran the strategy and got 7 trades.
Check the "Log" tab in the Control Center. You'll probably find error messages in there because your code probably has runtime exception(s). You need to take care of that. Your try/catch that you commented out must have been "handling" the exceptions so the backtest could continue to run without further problems. WIthout the try/catch there the strategy will stop trading when exceptions occur.
The following user says Thank You to shodson for this post:
Thanks for your advice! It does not make sense to me how it could be covering up the error because the try and catch are on the same line with no code in between it. But I will debug as per your advice as you know more than me and it does not need to make sense to me ).
try/catch will catch exceptions so you can "handle" them in the catch code block so the program can continue on in a way that you see fit. Without the try/catch if an exception happens Ninjatrader will just stop running your strategy if your exception is not handled
As you can see, I don't have any code inbetween the "try" and the "catch". So that is what I mean about it is hard to believe that it is catching an error.
But obviously, you are right because it is stopping an error from happening when it is in the code, even when written like that.
By the way, what is the point of the Log? You said to reference the log. Does it only just notify you of an error? Because it does not give any specifics. So basically, if the log has an error, then you use the try/catch to find out what that error is?