NinjaTrader Support Forum  

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 10-01-2009, 01:46 PM   #1
huracan
Junior Member
 
Join Date: Aug 2009
Location: Gahanna, OH
Posts: 14
Thanks: 0
Thanked 0 times in 0 posts
Default Help with Log error

Wrote an indicator with the following main body:

/// </summary>
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Trendy"));
Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "OO"));
CalculateOnBarClose = true;
Overlay = false;
PriceTypeSupported = false;

}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{

if(High[0] > High[1])
trender++;
if(High[0] < High[1] )
trender--;
if( Low[0] < Low[1] )
trender--;
if( Low[0] > Low[1] )
trender++;
Print("Trender is: " + trender.ToString());
Trendy.Set(trender);
//OO.Set(0);
}

I get the following Log message:

Error on calling OnBarUpdate method for indicator Tractor on bar 0: index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

I didin't explicitly use index, so I'm a little puzzled......
huracan is offline  
Reply With Quote
Old 10-01-2009, 01:52 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Please see this tip: http://www.ninjatrader-support2.com/...ead.php?t=3170
NinjaTrader_Josh is offline  
Reply With Quote
Old 10-01-2009, 02:07 PM   #3
huracan
Junior Member
 
Join Date: Aug 2009
Location: Gahanna, OH
Posts: 14
Thanks: 0
Thanked 0 times in 0 posts
Default Thanks

Thank you for the quick reply, Ray.
huracan is offline  
Reply With Quote
Old 10-01-2009, 02:27 PM   #4
huracan
Junior Member
 
Join Date: Aug 2009
Location: Gahanna, OH
Posts: 14
Thanks: 0
Thanked 0 times in 0 posts
Default Thanks

I should say - thanks Josh
huracan is offline  
Reply With Quote
Old 10-01-2009, 02:41 PM   #5
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

You are welcome.
NinjaTrader_Josh 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
Help need with error log Trevor.Richter Automated Trading 1 04-11-2009 01:18 AM
Error in Log decklin17 Indicator Development 2 04-10-2009 03:36 PM
Strategy error in Log -- what is it? cassb Strategy Development 22 04-25-2008 07:03 AM
Error in Log File BradB Strategy Development 3 04-26-2007 12:46 AM
Error in log SuzyG Strategy Development 4 01-17-2007 01:17 AM


All times are GMT -6. The time now is 03:24 PM.