Can someone help me understand how tick by tick data might be presented or appoximated during historical fill and how that differs from the way tick data is loaded during live trading. Thanks for anyones time!
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Tick data Questions - Historical vs Live
Collapse
X
-
Tick data Questions - Historical vs Live
I have a fair bit of experience with ninjascripts and have had a lot of succcess using 1 tick data series to get consistent, replicatable results between live data and historical fill. However, I have a strategy that uses a 1 tick added data series and trades on that data series and based on reviewing the print functions from each tick, the tick by tick information presented in historical fill senarios appears to be significantly different to the live data the strategy receives, and causes completely different behavior, far beyond the usual slippage and market condition related discrepancies.
Can someone help me understand how tick by tick data might be presented or appoximated during historical fill and how that differs from the way tick data is loaded during live trading. Thanks for anyones time!Tags: None
-
Hello dofkop,
Thank you for your post.
What Calculate setting is your strategy using? This can also affect the historical performance. If you are using anything other than OnBarClose, you would also need to enable Tick Replay.
Additionally, are you using any Set methods within your script? Set methods can only use data from the primary series, so it cannot use the data from any added 1-tick series.
I recommend reading through this support article which goes into detail on comparing strategy results. There is also sample script near the bottom of the page that can be used to write out bar data and execution information to a text file, to show what is different when comparing real-time results with historical:
Below is some info on historical vs. live:
Live orders are filled on an exchange with a trading partner on an agreed upon price based on market dynamics. Backtest orders are not using these market dynamics. Instead these are filled based on logical rules from processing historical data.- When in historical data, only the Open, High, Low, and Close will be available and there will be no intra-bar data.
- This means actions cannot happen intra-bar, fills cannot happen intra-bar. All prices and actions come from and occur when the bar closes as this is all the information that is known
- Because of this, OnBarUpdate will only update 'On bar close' as it does not have the intra-bar information necessary for 'On price change' or 'On each tick' and the script will not have the intra-bar information to accurately fill an order at the exact price and time.
- This allows for more accurate trades by supplying the correct price at the correct time for the order to fill with. The orders placed will need to use the BarsInProgress (BarsArray) index of that finer resolution series.
In NinjaTrader 8, there have been two new enhancements so that programmers may not have to manually add this secondary series and code the script for high accuracy fills (Order Fill Resolution) or for intra-bar actions (TickReplay) depending on the needs of the script.
Note: bar types that are IsRemoveLastBarSupported cannot be used with TickReplay and generally cause inaccurate results when backtesting in historical data.
Note: High Order Fill Resolution allows for intra-bar order fills with historical processing, but is not compatible with Tick Replay.
Please see this support article for a detailed explanation:
https://support.ninjatrader.com/s/ar...ar-granularity
- When in historical data, only the Open, High, Low, and Close will be available and there will be no intra-bar data.
-
Thanks for your response,
I'm using Calculate.OnEachTick but its my understanding that since I am using a multi-timeframe script (loading the 1 tick data series) that Tick Replay is not needed, however I have experimented with it on and off and still not getting any results similar to live playback.
I am not using any Set methods that would be unable to access the secondary bar series.
Sadly I've reviewed the provided reference information and am still left confused and stuck. This is my first strategy that is constantly comparing data between individual ticks provided by the 1 tick data series, and the comparison results on the output print statements are significantly different on the tick by tick, as if, depending on if we are in historical, live market, or playback, granularity is varying widely.
It appears that the live data provides varying packages of ticks at the same prices, while the historical fill with tick replay provides more granular movement data. I've attached a screenshot from the two data series to give an idea of what I mean, the red makrs indicate change of tick price.
Is this expected? and is there a way to get the historical fill to more similarly resemble the live data?
Comment
-
Tick Replay is necessary if you are using Calculate.OnEachTick, even with the added 1-tick series. Tick Replay is necessary for intrabar actions, while intrabar granularity is for more accurate order fills.
Can you please test using the Real-time Replay Historical Comparisons Test script, or incorporate the logic into your script? In particular, the tick data and bar data results can help pinpoint where data may be different and this script prints out the OHLC values as well as the BarsInProgress value of which Bars are updating. Make sure Tick Replay is enabled during this test.
It would also be helpful to get the debugging output from your own script. This way we can compare where the strategy is taking different actions in realtime vs historical, and compare the bar data from the above script to further pinpoint the issue.
In the strategy add prints (outside of any conditions) that print the date time of the bar and all values compared in every condition that places an order.
The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.
The debugging print output should clearly show what the condition is, what time the conditions are being compared, all values being compared, and how they are being compared.
Further, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.
After enabling TraceOrders remove the instance of the strategy from the Configured list in the Strategies window and add a new instance of the strategy from the Available list.
I am happy to assist you with analyzing the output from the output window.
Below is a link to a support article that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.
https://support.ninjatrader.com/s/ar...nd-TraceOrders
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
62 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
134 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|

Comment