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

Highlow Indicator Bug

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

    Highlow Indicator Bug

    Hello

    I'm using the very useful Highlow indicator quite extensively and it's generally working well but at times it will freeze and produce the following error message:

    "Error on calling 'On Bar Update Method' for Indicator 'Highlow'. You are accessing an index with a value that is invalid since it's out of range, ie accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart."

    I have no idea what happens here (there are always more than 5 bars on my charts) and it would be great if this bug could be removed.

    When the indicator freezes I remove it manually and reapply it immediately. Sometimes this works and sometimes it freezes again shortly afterwards. When I reapply it a few hours later it always works fine.

    Thanks

    PS: The code is attached
    Attached Files
    Last edited by laocoon; 11-02-2010, 10:10 AM.

    #2
    Hello laocoon,

    The issue comes when accessing empty objects. More information can be found here:
    Make sure you have enough bars in the data series you are accessing

    This is most likely related to your values that use NBar:

    Low[NBar]

    You can use Try - Catch blocks to help catch exceptions and provide more details on which lines are causing it.
    Using Try-Catch Blocks
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Look here

      try Big Mike Trading
      Edit - look under free downloads - and/or elite downloads.

      here is one I posted there a while back.
      Attached Files
      Last edited by Mindset; 11-03-2010, 01:40 AM.

      Comment


        #4
        @RyanM: Thanks for your sugestion, will look into it.
        @Mindset: Thanks for posting your indicator, much appreciated. I'm currently testing it, looks good so far. May I suggest an improvement that will probably be useful for quite a few traders: it would be awesome to have the DEFINITIVE High & Low of a candle displayed for a few more seconds AFTER the candle has closed. The reasoning behind this is that when you use a gray box (trading strategy that triggers an alert when certain criteria are met but doesn't send the order), the alert is often triggered at the close of the bar. If you enter one tick above the high of the bar (for Longs), you obviously need to have the high of the (closed) bar displayed for a few more seconds once the alert has triggered in order to be able to place the order properly.

        Thanks.
        Last edited by laocoon; 11-10-2010, 01:40 AM.

        Comment


          #5
          Mindset,

          After extensive testing I can say that your indicator is excellent and very stable, even in very fast market environments. Could you tell me if the feature suggestion I made in my previous post is easy to code or is this a more complex endeavour?

          Thanks a lot.

          Comment


            #6
            delay

            probably requires it's own timer. If I get time I will have a look into it.

            Comment


              #7
              delay

              Thinking about this... I don't understand what you are asking? At the start of a new bar the high low indicator will show you the high and low of the prior bar for the full duration of the new bar assuming you set the Display Bar No to 1. That is what it was designed for ... or am I missing some point?

              Comment


                #8
                I just saw your latest post and realised that by doing what you're suggesting (the Display Bar No is set to 0 on my charts right now) your indicator does exactly what I wanted it to do. Awesome! Thanks again for taking the time to reply and for sharing your fantastic indicator.

                Comment


                  #9
                  One last question: in the "Bool" section of the paramters of your indicator, I only have "ShowHiLo" set to true, all others are set to false. Is there a way to remove the number in brackets, for example "(-5)" when the current candle makes a lower low or a higher high "(4)" than the previous one in order for the indicator to ONLY display the High & Low of the last candle and nothing else?

                  Thanks

                  Comment


                    #10
                    comment out

                    No - but if you don't want it comment out the following lines


                    highstring.Append(String.Format("({0})", breakupdiff));

                    lowstring.Append(String.Format("({0})", breakdowndiff));

                    Comment


                      #11
                      perfect, thanks a lot.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by alifarahani, Today, 09:40 AM
                      6 responses
                      30 views
                      0 likes
                      Last Post alifarahani  
                      Started by Waxavi, Today, 02:10 AM
                      1 response
                      17 views
                      0 likes
                      Last Post NinjaTrader_LuisH  
                      Started by Kaledus, Today, 01:29 PM
                      5 responses
                      13 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by Waxavi, Today, 02:00 AM
                      1 response
                      12 views
                      0 likes
                      Last Post NinjaTrader_LuisH  
                      Started by gentlebenthebear, Today, 01:30 AM
                      3 responses
                      17 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Working...
                      X