Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plotting Lines at nearest 1/8 centries

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

    #16
    Hello cbart,

    I tested your code and do not have any issues with OnBarUpdate errors.

    You will need to use Try-Catch blocks to isolate the segment in your code which is throwing the error as we would not be able to debug this for you.

    More information on using Try-Catch blocks can be found below:

    MatthewNinjaTrader Product Management

    Comment


      #17
      Originally posted by cbart_1 View Post
      I changed the for(EC = 15; EC <= 0; EC--)
      to
      for(EC = 15; EC != 0; EC--).
      It is entering the loop but when it gets to the correct if statement it gives an error.

      I put Print(EC); in the for loop and it prints 15, 14, 13, 12 , 11 and then it gives the error:

      Error on calling 'OnBarUpdate' method for indicator 'EightCentryPrices' on bar 15: Index was outside the bounds of the array.
      I do not really understand what you are trying to do, but I think you implied that you are drawing eighths into an octave. That means that you need 9 lines, so you will need 9 Plots which you can assign values after determining the extremes from which you wish to set your octave.

      I do not see the point of your for loop in this case, regardless if it is defective or not.

      Comment


        #18
        the for loop

        is so that i can check to see what centry we are on, but i would like for the plots to go away once it changes to the next nearest 1/8 centry.

        Comment


          #19
          I got it

          Thank you guys for your help. I was going about it at the wrong way. I finally figured out how to do it without the for loop.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          607 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          353 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          560 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          561 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X