Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Load historical data from a strategy?

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

    Load historical data from a strategy?

    Hello,

    I need to pre-load 1 week of 1-minute historical data for selected instrument(s) when my strategy starts. Ideally, I'l like to populate the same DataSeries already selected with Add().

    Is there a way to accomplish this programmatically? Of cause, I can accomplish this through "extrernal" calls, but I'd like to use the same historical data managemer/connector already present in NT.

    Thank you.

    #2
    Hello gena72, unfortunately you could not load data programmatically, it would be the same lookback applied by NT as for your primary series on which the strategy is run.

    Another approach can be looking into the Pivots indicator that loads the data asyncronously, but unfortunately the methods used would not be supported by us.

    Comment


      #3
      Hello,

      Thank you for explaining this. Setting a lookback for, let's say 5 days, will pre-load the main DataSeries with historical data for selected instrument (and fetch it if necessary)?
      For instance, 5 days, is approximately 2500 bars, Will I be able to use Close[2500] inside the strategy?

      Comment


        #4
        Yes, you can access the historical data via the index in your strategy, however you would need to ensure to not attempt to access the data too early, as the OnBarUpdate() method is processed sequentially from left to right you otherwise run into situations where there's no data for x bars back is available...the most obvious being the CurrentBar = 0, so the first bar of the chart if you attempt to access Close[1] here you're getting an error returned from NT and the script would be terminated.

        Comment


          #5
          Let me get this straight. If I use a "lookback" function, onBarUpdate() will be called starting from which bar? The first real-time bar coming from the exchange (in which case CurrentBar > 0), or from the oldest bar loaded from historical data (which does not make sense for real-time strategy)?

          Comment


            #6
            It would be per default the oldest bar on the chart and then advance through all bars until it hits your current realtime bar.

            If you would like to not calculate anything on historical bars, use Historical to return out of OnBarUpdate() for those bars.

            Comment


              #7
              So the strategy will be actually running in two modes. Historical first, and then, real-time. Interesting, I will check this out.

              Thank you.

              Comment


                #8
                Correct, unless you filter with Historical - it arrives at it's historical strategy position and then trades live.

                Comment

                Latest Posts

                Collapse

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