Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Secondary Data Series Access

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Secondary Data Series Access

    Hello!

    Quick question,

    I have a multi time frame script. For this example we will assume it is using a 1 minute chart and the secondary data series is 60 minutes.

    I would like to access the current 60 minute candles open during a backtest but since it works OnBarClose when I access that open value (Opens[1][0]) it just gives me the last closed candles open. For example,

    Lets say it is 1:20pm. The 1:00pm candle was the most recently closed candle so even though there is a candle forming at this moment (the 2:00pm candle) if I ask for the Opens[1][0] I still get the open of the 1:00pm candle. Is there a way to get around this other than using the Closes[1][0] ? Sometimes there can be a gap, just figured I would ask.

    It works in realtime obviously when I have the strategy set to OnEachTick. Want to see if there is a workaround in Backtest

    Thanks!

    #2
    Hello Vikuno1,

    Thank you for your post.

    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.
    Intra-bar granularity adds a second data series such as a 1 tick series using AddDataSeries() so that the strategy or indicator has the individual ticks in the historical data in between the High and Low of the primary 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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    87 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    128 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    65 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    117 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X