![]() |
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 |
|
Junior Member
Join Date: Feb 2009
Posts: 21
Thanks: 6
Thanked 0 times in 0 posts
|
Hi, I am trying to check if there was an NBarsUp or -Down event during the last 7 bars. I tried this, but it doesn't work and I get an error message in the log: "Error on calling 'OnBarUpdate' method [...] You are accessing an index with a value that is invalid since its out of range.":
Code:
protected override void OnBarUpdate()
{
if (CurrentBar < 45)
return;
bool bNBarsUpEvent = false;
bool bNBarsDownEvent = false;
for (int i = 0; i <= 7; i++)
{
double valueUp = NBarsUp(nBarsPeriod, true, true, true)[i];
double valueDown = NBarsDown(nBarsPeriod, true, true, true)[i];
if (valueUp == 1)
{
bNBarsUpEvent = true;
BackColor = Color.Green;
}
if (valueDown == 1)
{
bNBarsDownEvent = true;
BackColor = Color.Red;
}
}
}
|
|
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Error Log | Mindset | Suggestions And Feedback | 3 | 08-17-2010 05:22 AM |
| NT7B15: Error dialog loop | nailz420 | Version 7 Beta General Questions & Bug Reports | 6 | 05-07-2010 05:32 AM |
| Help with Log error | huracan | Indicator Development | 4 | 10-01-2009 02:41 PM |
| 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 |