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 cmoran13, 04-16-2026, 01:02 PM
          0 responses
          43 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          25 views
          0 likes
          Last Post PaulMohn  
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          162 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          98 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          158 views
          2 likes
          Last Post CaptainJack  
          Working...
          X