Finding the Ninjascript documentation to be very confusing and thin to be honest. I'm not finding the examples to be very helpful. Referencing bars seems more complicated than what it should be.
I'm getting out-of range errors and have been trying to change the "CurrentBar < X" values to make it work without luck.
Since Ninjatrader reads from left to right is there a way to skip all the bars from the left and only work with for example the most recent 50 bars from the right?
Like doing something like "If CurrentBar == MostRecentBar"
In MT5 there is a way to "copy rates" into an array and reverse it so that your last rates (Ninjatraders most recent bar to the right) will be the first in the array. You can then work with that array from the right side. It makes things so much easier. Is there a way to do this in Ninjascript? I rather not scan through the entire chart just to work with the most recent bars. Is there something like "Close[LastBar]" to make things easier to work from the right side of the chart?
If I wanted to store the swing highs/lows from this picture below, with some simple pseudo code, would Close[100] be the bar to the left of the top and Close[101] be the downbar?
If so, then a for-loop would need to count down to go through the bars to the left correct? If these bars were the most recent ones to the right side of the chart instead, what would be the best way to loop through them?
Comment