Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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?
    BertrandNinjaTrader Customer Service

    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.
        BertrandNinjaTrader Customer Service

        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.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bortz, 11-06-2023, 08:04 AM
            47 responses
            1,605 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            8 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            4 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            13 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X