Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 dward123, 01-02-2024, 09:59 PM
          4 responses
          174 views
          0 likes
          Last Post Lancer
          by Lancer
           
          Started by ETFVoyageur, Today, 04:00 PM
          2 responses
          19 views
          0 likes
          Last Post ETFVoyageur  
          Started by AaronKTradingForum, Today, 03:44 PM
          1 response
          13 views
          0 likes
          Last Post AaronKTradingForum  
          Started by Felix Reichert, 04-26-2024, 02:12 PM
          11 responses
          80 views
          0 likes
          Last Post Felix Reichert  
          Started by junkone, 04-28-2024, 02:19 PM
          7 responses
          84 views
          1 like
          Last Post junkone
          by junkone
           
          Working...
          X