![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Please this tip: http://www.ninjatrader-support.com/v...ead.php?t=3170
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
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
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
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...
|
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
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...)?
|
|
|
|
|
|
#7 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
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
NinjaTrader Customer Service |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
Thank you for your replies.
|
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Feb 2009
Posts: 153
Thanks: 0
Thanked 0 times in 0 posts
|
have you ever succeeded in programming this and is it available?
|
|
|
|
|
|
#10 |
|
Member
Join Date: Jul 2008
Posts: 79
Thanks: 0
Thanked 1 time in 1 post
|
I would also be interested in this indicator.
Do you plan to release it or anything? thanks, robert |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Session times/bar calc | nicko9 | Market Analyzer | 5 | 05-25-2009 12:55 AM |
| Calc an angle? | Burga1 | Indicator Development | 1 | 01-29-2008 09:52 AM |
| CCT Bollinger & CCT Keltner | mav8rick | NinjaScript File Sharing Discussion | 2 | 12-22-2007 04:30 AM |
| Bollinger Bands & RSI | garciaal | Indicator Development | 1 | 10-29-2007 02:06 PM |
| Bollinger Bands setting | Quicktrader10 | Charting | 1 | 10-04-2006 03:59 PM |