Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars are not loaded

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

    Bars are not loaded

    Hi,

    I have a strategy with the following functions defined:

    Code:
    protected override void Initialize()
            {	
                            CalculateOnBarClose = true;
    			Add(PeriodType.Day, 1);
    			Add(PeriodType.Minute, 60);
    			Add(PeriodType.Minute, 5);
    			Add(PeriodType.Minute, 1);
            }
    protected override void OnBarUpdate()
    {
    			
    			if(CurrentBars[1]<7){Print("Not enough days:  " +CurrentBars[1]); return;}
    			if(CurrentBars[2]<150){Print("Not enough hours:  " +CurrentBars[2]); return;}
    			if(CurrentBars[3]<3){Print("Not enough 5min:  " +CurrentBars[3]); return;}
    			if(CurrentBars[4]<3){Print("Not enough 1min:  " +CurrentBars[4]); return;}
    			if(BarsInProgress!=2){Print("Not an hour update...");return;}
    			Print("Update Happening");
    }

    I set it on 60 Minute bars with loading 10 days and 200 bars and the output I get is:

    "Not enough days: 0"

    which just goes on and on.

    the question is why its not moving on to the next day and what could be done to solve it?

    Thank you,
    Sergey

    #2
    Sergey, the strategy OnBarUpdate() would only be starting to called as all series used have enough data points as defined by the BarsRequired setting. What have you set it at?

    Comment


      #3
      Hi Bertrand,

      I set Min. BarsRequired to 200, which is more then enough to load 7 days of data (as the main dataseries is 60 minute).

      Comment


        #4
        Sergey, that's way too high if you load only 10 days of data...you add a daily series so with this setting there would be no OnBarUpdate() calls to any series until you load 200+ bars.

        Comment


          #5
          Im a bit confused 24*7 (7 days with 60 min data) is 168 bars and I load 200, thats not much more is it? But after its loaded nothing is still happening thats what I dont understand.

          Comment


            #6
            BarsRequired is not setting how much data you load Sergey, it simply tells NT how much bars to let pass for all instruments until the OnBarUpdate() would be called.

            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
            333 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