![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Aug 2009
Location: Gahanna, OH
Posts: 14
Thanks: 0
Thanked 0 times in 0 posts
|
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...... |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Please see this tip: http://www.ninjatrader-support2.com/...ead.php?t=3170
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Aug 2009
Location: Gahanna, OH
Posts: 14
Thanks: 0
Thanked 0 times in 0 posts
|
Thank you for the quick reply, Ray.
|
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Aug 2009
Location: Gahanna, OH
Posts: 14
Thanks: 0
Thanked 0 times in 0 posts
|
I should say - thanks Josh
|
|
|
|
|
|
#5 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
You are welcome.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |