Plot0.Set(Open[0] == Close[0] ? 1 : 0);
Well, I used data from AAPL downloaded from yahoo and couldn't see a single bar. Well, I thought, maybe there never is an open equal to the close. How about an open greater than a close? So I used this formula
Plot0.Set(Open[0] > Close[0] ? 1 : 0);
Well this works. It basically shows all the red candles (the days where you close lower than the open). This works too
Plot0.Set(Open[0] < Close[0] ? 1 : 0);
It shows all the green candles (except the most recent one for some reason? At that datapoint, it fails to draw a bar even though the candle is green.)
So now I want to find those days where you open higher than yesterday's close. I use this:
Plot0.Set(Open[0] > Close[1] ? 1 : 0);
This shows nothing, even though there are clearly days with gaps-where you open higher than yesterday's close evident.
This also fails:
Plot0.Set(Close[1] < Open[0] ? 1 : 0); (just flipped the equation to make sure the program wasn't sufferring from a bug)
but this works:
Plot0.Set(Open[-1]> Close[0] ? 1 : 0); and it asks the same thing
And this also works
Plot0.Set(Close[0] < Open[-1] ? 1 : 0);
So it seems that asking for open[0] is giving ninjatrader a problem.
Then for fun I try
Plot0.Set(Open[0] > Close[-1] ? 1 : 0);
Where today's open is higher than tomorrow's close. This works fine. so open[0] is not a troublemaker.
However, this equation
Plot0.Set(Open[0] > Open[1] ? 1 : 0); shows nothing.
If I am correct, it asks for days where today's open is higher than yesterday's open. There are plenty of those but none are marked on the barpattern plot.
But this works fine
Plot0.Set(Open[0] > Open[-1] ? 1 : 0);
What is wrong? Help?!
Comment