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 sjsj2732, Yesterday, 04:31 AM
          0 responses
          31 views
          0 likes
          Last Post sjsj2732  
          Started by NullPointStrategies, 03-13-2026, 05:17 AM
          0 responses
          286 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          283 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          133 views
          1 like
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          91 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Working...
          X