Los Angeles, CA
Posts: 5 since Apr 2020
Thanks Given: 1
Thanks Received: 0
|
So when LRO = -1, that means that there isn't one on screen, but I am running into trouble when calling a function when it = -1.
I have an if statement:
if (intLRO> -1)
{
if (High[intLRO] >= High[intLRO-1])
{
Print("yes lro > 1 and high of lro is >= high of lro-1)"
///should only print when both are true.
}
}
However, I keep getting : Error on calling 'OnBarUpdate' method on bar 37: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
This is in reference to (High[intLRO] >= High[intLRO-1])
However intLRO = -1
I'm cofused as to why it is firing when intLRO = -1.
FYI, this works fine on ninjatrader 7, even without having if (intLRO> -1) to catch it.
|