Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Fibo Bollinger calc

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

    Fibo Bollinger calc

    Hi,

    I'm trying to code a Fibonacci Bollinger indicator. I'm getting an "index outside the bounds of the array" error in the log. I do not know what this means exactly, so I'm at a bit of a loss to correct it...the code is a modification of the Bollinger Bands code:

    privatedouble numStdDev = 2;
    privateint period = 14;
    double factor1 = 1.618;
    protectedoverridevoid Initialize()
    {
    Add(
    new Plot(Color.Cyan, "Upper band"));

    Add(new Plot(Color.Green, "Middle band"));
    Add(
    new Plot(Color.Orange, "Lower band"));
    }
    protectedoverridevoid OnBarUpdate()
    {
    Upper.Set(SMA(Close, Period)[0] + NumStdDev * (factor1 * ATR(Period)[0]));
    Middle.Set(SMA(Close, Period)[0]);
    Lower.Set(SMA(Close, Period)[0] - NumStdDev * (factor1 * ATR(Period)[0]));
    }

    Any clues on the cause and/or meaning of the error?

    #2
    Please this tip: http://www.ninjatrader-support.com/v...ead.php?t=3170
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply but that's not it. I have this as the first line in OnBarUpdate:

      if(CurrentBar < 30){return;}

      I've jacked it up all the way to a ridiculous number (120)...I still get the same error.

      Comment


        #4
        You will need to debug then. Comment out sections of the code till it compiles and then slowly uncomment them till you pinpoint the source of the error.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I've done so already. The Output Window simply prints the first bar and then nothing else. For some reason if I comment out all lines except the calculation for the "middle" plot, the error STILL happens, although I thought that it shouldn't...it's simply a SMA calculation...there's nothing else at that point to comment out...

          Comment


            #6
            I've did some additional work with it and seem to have it working. However the indicator is plotting in a window "below" the price chart, thus making it difficult to work with...how do I have the plots show on the price chart itself (in the same manner as a Bollinger Band indicator does...)?

            Comment


              #7
              When you load the indicator set it to Panel 1. You can also programmatically set this by using Overlay = true in the Initialize() method. If you have draw objects that you want on the price panel you will need to set DrawOnPricePanel = true in the Initialize() method too.

              Please take note that you will need the indicator to share the same y-axis scale as the price panel or else things will become very scrunched. This is a limitation in overlaying indicators that will be addressed in NT7.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Thank you for your replies.

                Comment


                  #9
                  any luck with Fibonacci Bollinger Bands

                  have you ever succeeded in programming this and is it available?

                  Comment


                    #10
                    I would also be interested in this indicator.

                    Do you plan to release it or anything?

                    thanks,
                    robert

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    576 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    334 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    101 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    553 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    551 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X