Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

return in OBU

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

    #16
    Hello,

    I get this message in the output window:

    You have reached the maximum threshold of the NinjaScript Output window. Some of your output messages have been suppressed.

    in the log:
    2021-02-19 14:07:58 Default Indicator 'MyCustomIndicator6': Error on calling 'OnBarUpdate' method on bar 0: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
    but i get those messages only if i introduce a break;

    On the printing side it looks like the right values but without a line plot on the chart its difficult to tell by looking at values one by one.

    Otherwise this is the code:


    Last edited by frankduc; 02-25-2021, 08:57 AM.

    Comment


      #17
      Hello frankduc,

      Thank you for that information.

      The output window is limited and has a maximum number of lines which is why you are seeing that message.

      When testing the code you provided I am able to see the yellow plot line plotting at a value of -10342.25.

      I see your loop is setting Value[0] in the loop instead of using the index, this means the loop will always change the current plot value.

      LastIndexChecked should be a class-level variable. If you set it to 0 before entering the loop, the loop always starts at 0.

      Also, you are not setting LastIndexChecked when you break your loop, so the loop is not stopping and starting at gaps.

      You should also be saving your "offset" to a class-level variable.

      And, you should be consistent using BarsAgo indexes vs. regular bar indexes in order to just work in one direction.

      Ultimately, designing the logic will be up to you. I recommend you focus on the approach given in post #10 while minding the above notes.

      Let us know if we may assist further.
      <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      601 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      347 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      559 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      558 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X