Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bar Index

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

    Bar Index

    I'm getting this error when trying a multi time frame strategy. I'm not sure why. Any explanation what this means? I'm not sure what is causing this problem.

    **NT** Error on calling 'OnStartUp' method for strategy 'xxxa': Bar index needs to be greater/equal 0

    Thanks

    #2
    Hello,

    Thanks for your note.

    Can you please post your OnStartUp() code and Initialize() code?

    I look forward to assisting you further.
    BrettNinjaTrader Product Management

    Comment


      #3
      Sure,

      Code:
      protected override void OnStartUp()
      		{
      			PrintWithTimeStamp("started: " + DateTime.Now);
      		}
      		
      		
      		
              protected override void Initialize()
              {	
      			if (AddIndicators == true)
      			{
      				Add(VOL());
      			}
      
                  CalculateOnBarClose = true;
      			TraceOrders = false;
      			Unmanaged = true;
      			//RealtimeErrorHandling = RealtimeErrorHandling.TakeNoAction; 
      			
      			Add(PeriodType.Second, 5);
      }
      Originally posted by NinjaTrader_Brett View Post
      Hello,

      Thanks for your note.

      Can you please post your OnStartUp() code and Initialize() code?

      I look forward to assisting you further.

      Comment


        #4
        Hello,

        Can you try changing PrintWithTimeStamp() to just Print() just in OnStartup()

        I was not able to duplicate on my side though. If you make this change and you still have issue I would need to have you send full code to support at ninjatrader dot com since I added the above to a test strat and no errors where thrown.

        Let me know if I can be of further assistance.
        BrettNinjaTrader Product Management

        Comment


          #5
          That seemed to have fixed it. Weird! Why would a PrintWithTimeStamp be a cause for that?

          humm.

          Thanks though!

          Comment


            #6
            Hello,

            PrintWithTimeStamp grabes the time stamp from the Bar Series Time[0]. Therefor in OnStartUp() the BarSeries does not exist yet therefor this coudl fail as a race condition.

            Let me know if I can be of further assistance.
            BrettNinjaTrader Product Management

            Comment

            Latest Posts

            Collapse

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