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 Hwop38, 05-04-2026, 07:02 PM
          0 responses
          169 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Started by CaptainJack, 04-24-2026, 11:07 PM
          0 responses
          327 views
          0 likes
          Last Post CaptainJack  
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          252 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          353 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          180 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Working...
          X