Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnBarUpdate Error

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

    OnBarUpdate Error

    I am getting the following error message in a multi-timeframe strategy:

    " **NT** Error on calling 'OnBarUpdate' method for strategy 'ZLReMTF/e610e684089b44a2b751f1e4043ed90d': You must use the overload that has a 'BarsInProgress' parameter when calling the BarsSinceExit() method in the context of a multi-time frame and instrument strategy."


    The code associated with BarsSinceExit is:


    if(BarsInProgress == 0)
    {
    TimeSinceExitOK = BarsSinceExit() >= 1 || BarsSinceExit() == -1;
    TimeSinceEntryOK = BarsSinceEntry() >= 1 || BarsSinceEntry() == -1;
    }


    Anyone have any ideas?


    Rod

    #2
    Hello,

    BarsSinceExit() has an overload for the barsInProgressIndex that needs to be specified in an multi series script.

    BarsSinceExit(int barsInProgressIndex, string signalName, int exitsAgo)

    For example,

    if(BarsSinceExit(1, "mySignal", exitago) == 1)

    Where 1 is the BIP
    MatthewNinjaTrader Product Management

    Comment


      #3
      I must be doing something wrong...

      I am getting the same error


      I have changed my code as follows
      TimeSinceExitOK = BarsSinceExit(1,"ZLRe1",0) >= 1 || BarsSinceExit(1,"ZLRe1",0) == -1;
      TimeSinceEntryOK = BarsSinceEntry(1,"ZLRe1",0) >= 1 || BarsSinceEntry(1,"ZLRe1",0) == -1;
      In your post, you used the barsInProgressIndex of 1. That is not the primary data, is it?

      Comment


        #4
        barsInProgressIndex of 1 would be the second data series.


        The primary series is 0. Do you continue to receive errors if you use 0 as the bIP Index?
        MatthewNinjaTrader Product Management

        Comment


          #5
          my mistake - I had changed to '0' but I had missed one instance of BarsSinceExit in the code

          problem solved

          thanks

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          663 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          376 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          110 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          575 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          580 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X