- Live NinjaTrader Continuum (connecting to Phillip Capital clearing firm) connection using RealTime data or
- Playback connection using Market Replay data (a special RealTime data form which allows to control the speed in which the RealTime data is processed)
When trying to compare the results between orders filled with RealTime data and Historical data, there is nothing I can due to alter the behavior of order filled with RealTime data. If trading with a Live account, the order is subject to market dynamics. If trading with a simulated account, the order fill is subject to NinjaTrader's trade simulation engine https://ninjatrader.com/support/help...simulation.htm. The only way to close the gap between the results of RealTime data and Historical data lays in the techniques that NinjaTrader offers to do fill with Historical data.
To attempt to get closer results when doing order fill resolution with Historical data, one must use techniques which allow you fills based on intrabar data. By default, NinjaTrader ignores intrabar data when fill order using Historical data. (Source: https://ninjatrader.com/support/help...ical_fill_.htm and https://ninjatrader.com/support/help...fill_logic.htm)
These are three techniques which alter the way orders are filled when processing Historical fills by allowing intrabar order fills:
- Tick Replay (new technique in NinjaTrader 8)allows
- Although Tick Replay allow access to 1 tick (intrabar data) historical data, this technique should NOT be used to order fill resolution on Historical data.
- Source: https://ninjatrader.com/support/help...ick_replay.htm
- "Tick Replay was NOT designed to provide accuracy in backtesting concerning order fills and execution and should NOT be used to expect the exact sequence of executions as running a strategy on live data. For greater order-fill resolution and accuracy in strategy backtesting, you can use the High Fill Resolution in the Strategy Analyzer. Furthermore you cannot combine both Tick Replay and High Order Fill resolution."
- Source: https://ninjatrader.com/support/help...ick_replay.htm
- Although Tick Replay allow access to 1 tick (intrabar data) historical data, this technique should NOT be used to order fill resolution on Historical data.
- Order fill Resolution (new technique in NinjaTrader 8)
- At the strategy level, there is the Order Fill resolution parameter (https://ninjatrader.com/support/help...ical_fill_.htm section "Understanding order fill resolution". When set to High, 1 Tick, it uses a 1 Tick data series of the LAST price. It does not give you access to the BID and ASK data series.
- When working with Market orders, LONG orders tend to filled at ASK price and SHORT orders tend to be filled at the BID price. This is just one reason one would like to have access to the BID and ASK 1 tick data series instead of just the LAST 1 tick data series.
- At the strategy level, there is the Order Fill resolution parameter (https://ninjatrader.com/support/help...ical_fill_.htm section "Understanding order fill resolution". When set to High, 1 Tick, it uses a 1 Tick data series of the LAST price. It does not give you access to the BID and ASK data series.
- Intrabar granular fill using NinjaScript (source: https://ninjatrader.com/support/foru...ularity?t=6652)
- This technique allows the developer to add the LAST, ASK and BID 1 tick data series and pick & chose which data series to use based on the order type by using an order method overload (source: https://ninjatrader.com/support/help...rumentStrategy section "Working with a Multi-Instrument strategy")
- Using the order method overload provides access to the barInProgressIndex method parameter which can be use to set the data series which will be use for the order fill resolution.
- This technique also can be altered by the "Fill limit orders on touch" strategy parameter when using limit orders
- This technique allows the developer to add the LAST, ASK and BID 1 tick data series and pick & chose which data series to use based on the order type by using an order method overload (source: https://ninjatrader.com/support/help...rumentStrategy section "Working with a Multi-Instrument strategy")
When comparing the results between order fill resolution using Historical data vs RealTime, there is a significant discrepancy. The discrepancy is so large, that I don't see a reason why one would go through the trouble of backtesting (order fill resolution using Historical data). One runs backtest or the optimizer and finds the ideal parameters for a set of backtesting data. Then I download the Market Replay data for the backtesting period, and I set the Playback connection using the Market Replay to replay the same period of the backtesting.
When I examine trade by trade, I see the discrepancies between NinjaTrader's trade simulation engine and the intraday granular fill.
QUESTIONS:
- Is there a technique I am not aware of which allows me to get closer between the two results?
- Does unmanaged approach gives me other tools that can help improve the order fill resolution using Historical data? I am currently using Advance Order Handling approach
- Source: https://ninjatrader.com/support/help...ick_replay.htm
- In the first sentence "Tick Replay is used to playback 1 tick historical data to build the bars as if they had been build live, this means that tick data will be thrown as Market Data events in historical and subsequently OnMarketData and OnBarUpdate events will be called as if it was live", I am confuse by Market Data events and OnMarketData and OnBarUpdate event. When I read it, it sounds like there are Market Data events, followed by OnMarketData and then by OnBarUpdate events. Please help me clarify this.
- On the screenshot which I have included as an attachment, when looking at the legend (right side), should I be reading this graph from right to left? If so, what happened to the orange zero bar which should be the first "Actual Tick Event". I have been reading this chart from left to right for the longest time.
- Tick Replay relays on the OnMarketData() event (https://ninjatrader.com/support/help...marketdata.htm). Could you provide with a better sample than one provided on the help guide. The one of the help guide only displays BID, the ASK and LAST. What else can one do in this event which one cannot do in the OnBarUpdate(). I am trying to understand the Tick Replay potential.
- If "Intrabar granular fill using NinjaScript" is the way to go, could you provide a simple snippet which demonstrates how I test for a certain LAST volume after the trigger has occurred? I want to fill when using the LAST at a certain price point (example limit order) but ONLY if there has been sufficient (hard coded) volume at a certain level. Sometime I get fills because the price touched the limit price. I would like to make it more complex by saying that price has touched after the order trigger and that it has a certain volume.. "Fill limit orders on touch" parameter will be enabled in this particular scenario.
- Do ASK and BID 1 tick data series have volume? if so, what does the volume represent?
Lots of information, but before writing this post I have tried to do as much research as possible.
Comment