I have been backtesting a custom strategy which has been working fine in the strategy analyzer. Now that I'm trying to enable the strategy in Market Replay it is not activating and therefore not executing trades. I have added some print statements to try and determine where the issue is.
As it relates to the OnStateChange section of the script; it sets the defaults and then configures the strategy and successfully enters the state of DataLoaded but it never prints that it entered the Active state as requested.
As for the OnBarUpdate section; the first thing I have in the script is a request to print the current bar. It does do that even though it never prints that it entered an active state.
Once the script gets here it just continues to print the current bar and never enters any trades.
There are no errors in the logs and the last thing it logs is that it is "Enabling Ninjascript strategy (STRATEGY NAME)".
Prior to this I was getting incorrect responses related to Minimum bars for trading and trading times. Print statements showed that it was determining there weren't enough bars to trade even though it showed the requirement to be 50 and the current bar greater than 50. Similarly for the time window it stated that it was not within the trading time window while it was. I removed those from the script to see if I could get it to work and the results I described above began.
Any help would be appreciated. I'm sure I'm doing something wrong as seems to be the case for most of the posts I have read here but I can't seem to find one related to this specifically.
Thanks!

Comment