Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using historical data in live strategy

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

    Using historical data in live strategy

    I am writing a script to automate my strategy, in the script I need to refer to historical data ( 1 or 2 months back). when I started backtesting the strategy, I want to test for example for 2 days, the script doesn't load the historical data. so as soon as the script refers to historical data by bar index number it gives error and stops.

    what I need to write so that the script can access the historical data?
    any help please
    thanks

    #2
    Originally posted by alomaria View Post
    I am writing a script to automate my strategy, in the script I need to refer to historical data ( 1 or 2 months back). when I started backtesting the strategy, I want to test for example for 2 days, the script doesn't load the historical data. so as soon as the script refers to historical data by bar index number it gives error and stops.

    what I need to write so that the script can access the historical data?
    any help please
    thanks
    You cannot refer to data that you have not loaded. That is a logic issue, not a NT issue. If you need to refer to data, load the data, and gate the processing by using a time filter to ensure that you only start processing from however many days that you want to process.

    Comment


      #3
      Koganam, thanks for your answer, However, I have already the data loaded in NT database ( 4years data), I managed to do the backtesting using time filter in the script, but when I run the back test instead of putting 2 days period I put the start date as 2 months before the start date I want to test, so that the script read all the bars of 2 months to process and then process my 2 days test period. I am worry how I will handle this issue when I put the strategy live, I will not wait for 2 months in real time!! can you or any one help?? thanks

      Comment


        #4
        Originally posted by alomaria View Post
        Koganam, thanks for your answer, However, I have already the data loaded in NT database ( 4years data), I managed to do the backtesting using time filter in the script, but when I run the back test instead of putting 2 days period I put the start date as 2 months before the start date I want to test, so that the script read all the bars of 2 months to process and then process my 2 days test period. I am worry how I will handle this issue when I put the strategy live, I will not wait for 2 months in real time!! can you or any one help?? thanks
        I do not see why that is an issue. if you need to refer to data from 2 months ago, there is no alternative but to load that data. If your processing is gated to process only the previous 2 days, then you are at the last bar on the chart, so you will process only the last 2 days. What is the waiting for 2 months that you are talking about? When the strategy is live, it will read what data it needs and process that data however you say.

        Comment


          #5
          alomaria, welcome to our forums - what error message are you exactly getting please in the process?

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          571 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          331 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
          549 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          549 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X