So I coded a strategy and ran it through vigorous backtesting and it's working half decent. So the next step in my plan is to SIM test it to see if there are differences in the results before I consider going Live with it.
When I place it in SIM, the Stop-Loss doesn't trail. In my backtesting the stop-loss trails just fine.
I have the stop-loss coded where each time a new bar opens in a 5-min HeikenAshi Chart, the Stop-loss is placed at 2 ticks worse than the previous bar (Low or High depending on a sell or buy trade). So:
- In a sell trade the stop-loss would be placed at High[1] + 2 ticks.
- In a buy trade the stop-loss would be placed at Low[1] - 2 ticks.
It works beautifully.
I call the stop-loss using the SetStopLoss method using CalculationMode.Price. I call this each time the Stop-Loss needs to be moved to the new bar and NinjaTrader seems to handle the removal of the original position of the stop-loss. i.e. I don't have to remove it from what is now High[2] + 2 Ticks. I simply just Set it to High[1] + 2 ticks and it's done.
I am wondering if I have to set up a feature or option for this to work in a SIM situation. I am SIMming using a demo NinjaTrader account with that GQG feed that comes free for 2 weeks.
Do I have to set my ATM a specific way to allow my strategy to control the stop-loss?
Is there an Option in NinjaTrader that needs to be actiavted/deactivated to allow a strategy to control the stop-loss?
Why does the exact same stop-loss code work in Backtesting and not in SIM?
My backtest method was to download the individual NRD replay files from a provider and simply load the strategy in the chart and hit play. Then record the results in super detail. Then tweak and do it all over again until I felt I had something worthwhile which was not curve fitted. Which was a serious balancing act BTW lol
I didn't use the backtest tool built into NinjaTrader coz it only deals with OHLC data or some algorithmic variation which is not good enough for my needs. I wanted exact. So I hit play and watched the strategy trade the market for 3 years worth of data.
So I'm quite confident the stop-loss works in backtest. Just not in SIM. Maybe I'm doing something else wrong. Any ideas will be very appreciated.
Thanks!
Comment