I'm adding 1-tick sub timeframe to my 1min strategy to try and get around the fact that Backtesting only knows the OHLC of the 1min bar. I was getting some impossible fills and figured a 1-tick sub timeframe would correct for that. It doesn't seem to be the case.
When comparing backtest results with Market Replay, I see the backtest is still making impossible fills. The price (via Market Replay) in some cases doesn't come within a few ticks of hitting the limit buy price. Market Replay correctly doesn't have a fill. But the backtest does.
I'm beside myself trying to figure out how this is possible. With a 1-tick sub timeframe, you can't go any smaller. Yet it is still filling when it should not (again, price doesn't come within 3-4 ticks in some cases).
Assuming this is actually possible to do with NTraders backtesting, I cannot figure out what piece of the puzzle I'm missing.
There is only one thing that I question. Maybe this is messing things up. Hopefully someone can clarify.
1) Using BarsInProgress 0 (the 1min bars). I look at the current bar and compare it to previous 1min bars for my initial condition (condition1Long) to setup.
2) Pretend condition1Long is now true. And because of that, on each BarsInProgress == 1 (1-tick setting) update, it looks for the price to go above the 1min bar high.
3) When the price goes above that previous 1min bar high. It places a Limit buy order at a price BELOW the current market.
4) This is where it gets screwy. For example, the price never comes back down within 3 or 4 ticks to allow for that Limit buy entry. However, in the 1min bar, the high and low span across both my entry and exit. Therefore faking out the backtest and making it think that a buy and sell happened. In reality, the price never dipped low enough to the buy limit price that happened in #2 above (the 1min bar that is in my limit-buy-price happened prior to the setup in #3).
So I guess my question is. When you enter a:
longEntryOrder = SubmitOrder(0,OrderAction.Buy,OrderType.Limit,contracts,longEntryPrice,0,"","Long");
I'm actually getting the results I'd expect if I wasn't using 1-tick sub timeframe.
Do I need to wait for a setup, call that condition2Long, and watch the 1-tick price further for it to come back down to my entry and enter a market order instead of a limit? That is extra work and isn't as clean, but if this is the only way to get the backtest to work properly, I'll do it.
Thank you!!
Comment