Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reading Days To Load from within strategy?

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

    Reading Days To Load from within strategy?

    Hi

    Is it possible to read what "Days to load" is set to from within a strategy, perhaps with Initialize() or OnStartUp()? This would be useful to alert the user if it was set to a value too small.

    Regards
    Tony

    #2
    Hello,

    While not supported, you can use Bars.BarsData to find this property:

    Code:
    		protected override void OnStartUp()
    		{			
    			Print(Bars.BarsData.DaysBack);
    		}
    Last edited by NinjaTrader_Matthew; 11-21-2012, 02:02 PM.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Originally posted by Jellybean View Post
      Hi

      Is it possible to read what "Days to load" is set to from within a strategy, perhaps with Initialize() or OnStartUp()? This would be useful to alert the user if it was set to a value too small.

      Regards
      Tony
      Your question is clear as stated, but is that really what you are seeking? IOW, do you want to know what "Days to load" is set to, or are you really wanting to know how many days have actually been loaded on the chart?

      Comment


        #4
        Good question, Koganam.

        I really want to be sure that enough data is loaded to calculate a 200-day SMA in a strategy that operates on 1 min bars.

        The primary bars object is 1 min (TF 12-12) and I add the series for daily bars.

        I tried testing CurrentBars[1] when Historical is false, but I found that Historical is sometimes false even when historical bars of BarsArray[1] are being processed. I wanted to detect the situation where the user has loaded not enough days, but the test of CurrentBars[1] would always occur too early and indicate not enough data, even if "Days to load" was correct. There has been some discussion on this forum about it (related to the settings of "Days to load" and "Min. bars required"), but I couldn't figure out how it all worked.

        By checking that "Days to load" is set to a high enough value, at least I can prompt the user if they have set it incorrectly.

        That is fine for my purpose, but is there a better way?

        Cheers
        Tony

        Comment


          #5
          Originally posted by Jellybean View Post
          Good question, Koganam.

          I really want to be sure that enough data is loaded to calculate a 200-day SMA in a strategy that operates on 1 min bars.

          The primary bars object is 1 min (TF 12-12) and I add the series for daily bars.

          I tried testing CurrentBars[1] when Historical is false, but I found that Historical is sometimes false even when historical bars of BarsArray[1] are being processed. I wanted to detect the situation where the user has loaded not enough days, but the test of CurrentBars[1] would always occur too early and indicate not enough data, even if "Days to load" was correct. There has been some discussion on this forum about it (related to the settings of "Days to load" and "Min. bars required"), but I couldn't figure out how it all worked.

          By checking that "Days to load" is set to a high enough value, at least I can prompt the user if they have set it incorrectly.

          That is fine for my purpose, but is there a better way?

          Cheers
          Tony
          "Days to load" is merely a directive/request to load data. It may or may not match what is actually loaded. If your output depends on days loaded (not "to load"). then you should be looking at the days that are actually loaded.

          Comment

          Latest Posts

          Collapse

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