Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Requesting bars with TickReplay enabled

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

    Requesting bars with TickReplay enabled

    Hey guys,
    I created an add-on to display data.
    After finishing my window with WPF stuff, I open the BarsRequest documentation and notice that there is no option to request data with TickReplay enabled.
    Researching how NT does in the windows that request data, I think I discovered that the data is actually requested with the static function Bars.GetBars:

    Code:
    "public static void GetBars(instrument instrument, BarsPeriod barsPeriod, DateTime fromDateLocal, DateTime toDateLocal, TradingHours tradingHours, bool isDividendAdjusted, bool isSplitAdjusted, bool isTickReplay, bool isResetOnNewTradingDay, LookupPolicies lookupPolicies, MergePolicy mergePolicy, bool isSubscribed , IProgress progress, boo l calculate Rollovers, object state, Action<Bars, ErrorCode, string, object> callback)"
    If I understand correctly, NT calls this function and sets up a callback.
    In this callback something happens and finally the OnBarUpdate event and others become available for use.

    My question is:
    How to request 5-minute bar data with TickReplay enabled (historical data only)?
    If my idea of ​​how NT does this is correct, how do I set up the callback for the Bars.GetBars function?
    I just want to do calculations with the close value (TickReplay enabled, historical data only).​

    #2
    Hello rafaelcoisa,

    TickReplay only applies to price Series<double> objects updating in the OnBarUpdate() override which cannot be used in an Addon.
    Meaning, TickReplay will not apply to an addon script.

    From an addon you can do a BarsRequest to request data.
    Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      hey NinjaTrader_ChelseaB,
      I understand what you said.
      But in the callback you can pass an ISeries<double> object and work from there or something.​

      Comment


        #4
        Hello rafaelcoisa,

        Passing in a series as a parameter to a method in a custom class would require that to be called from OnBarUpdate() from an indicator or strategy. Which is where the TickReplay would be applied.

        Addons do not have native series or OnBarUpdate().
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hey NinjaTrader_ChelseaB,
          Yes, there is no OnBarUpdate in the Addon, that's why I'm talking about this function and its callback:​

          Code:
          "public static void GetBars(instrument instrument, BarsPeriod barsPeriod, DateTime fromDateLocal, DateTime toDateLocal,
                                                 TradingHours tradingHours, bool isDividendAdjusted, bool isSplitAdjusted, bool isTickReplay, bool isResetOnNewTradingDay,
                                                 LookupPolicies lookupPolicies, MergePolicy mergePolicy, bool isSubscribed ,
                                                 IProgress progress, bool calculate Rollovers,
                                                 [B]object state, Action<Bars, ErrorCode, string, object> callback[/B])"

          Comment


            #6
            Hello rafaelcoisa,

            This is not a supported method documented in the help guide, so there may be unexpected behavior.

            The way to get historical and real-time data in a script is with a BarsRequest or a MarketData event handler (for real-time only).
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I think it is technically possible to do but too convoluted.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              574 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              332 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              553 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              551 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X