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.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 

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 02:42 PM.