I have searched a lot via Google and these forums to try to understand how to resolve this type of situation in historical backtesting. I will describe the process of my indicator and strategy, and then the error that occurs.
1) Indicator generates signals with OnBarClose = true
2) Strategy checks indicator signals and open positions OnBarClose = false
3) If signal is valid on the last bar close, the strategy enters the next bar @market which is marked as the Open if historical testing. I am using all managed order methods for stops and targets, so ExitShortStop, ExitLongStop, ExitLongLimit, and ExitShortLimit.
My issue is as follows and would occur for a long or short trade that would be in this situation in historical testing, my guess it would be fine in live trading.
My strategies' output window shows I have entered a Long trade at the Open after a closed bar with a valid signal on it. In live trading the next tick would be processed by my strategy and place the stop order (ExitLongStop), however using the strategy analyzer in historical testing this stop order is shown to be "ignored" because the stop price is greater than or equal to the close of the current bar. This is because the event goes from open to close bar as there aren't any ticks coming in. Because of this my position stays open and the strategy cannot proceed with any new trades and then just closes at the end of the data date range I supplied to the analyzer.
How can I work around this issue and make sure my stop order gets accepted by the historical analyzer to test my strategy properly?
I have included a screenshot of the chart tab from the strategy analyzer and the issue in question is outlined there as well.
Thanks,
Charles
Comment