NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 04-13-2008, 07:42 PM   #1
Burga1
Senior Member
 
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
Default 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?
Burga1 is offline  
Reply With Quote
Old 04-13-2008, 10:32 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Please this tip: http://www.ninjatrader-support.com/v...ead.php?t=3170
NinjaTrader_Josh is offline  
Reply With Quote
Old 04-13-2008, 10:38 PM   #3
Burga1
Senior Member
 
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
Default

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.
Burga1 is offline  
Reply With Quote
Old 04-13-2008, 10:49 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

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.
NinjaTrader_Josh is offline  
Reply With Quote
Old 04-13-2008, 11:03 PM   #5
Burga1
Senior Member
 
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
Default

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...
Burga1 is offline  
Reply With Quote
Old 04-13-2008, 11:25 PM   #6
Burga1
Senior Member
 
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
Default

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...)?
Burga1 is offline  
Reply With Quote
Old 04-14-2008, 02:09 AM   #7
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

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.
NinjaTrader_Josh is offline  
Reply With Quote
Old 04-14-2008, 07:56 AM   #8
Burga1
Senior Member
 
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
Default

Thank you for your replies.
Burga1 is offline  
Reply With Quote
Old 09-22-2009, 03:54 PM   #9
trader1512
Senior Member
 
Join Date: Feb 2009
Posts: 153
Thanks: 0
Thanked 0 times in 0 posts
Default any luck with Fibonacci Bollinger Bands

have you ever succeeded in programming this and is it available?
trader1512 is offline  
Reply With Quote
Old 09-22-2009, 10:08 PM   #10
rretch
Member
 
Join Date: Jul 2008
Posts: 79
Thanks: 0
Thanked 1 time in 1 post
Default

I would also be interested in this indicator.

Do you plan to release it or anything?

thanks,
robert
rretch is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -6. The time now is 08:17 PM.