PDA

View Full Version : Subtract an indicator


snake
06-06-2007, 02:10 PM
How can I set up the following in NinjaScript? I just can't seem to find out how to do using Help.

CCI-CCI[1]>5

Highest(CCI,5)>=100

Thanks for any help,

snake :o

NinjaTrader_Ray
06-06-2007, 02:22 PM
Hi Snake,

You can try:

if (CCI(20)[0] - CCI(20)[1] > 5)
// Do something

if (MAX(CCI(20), 5) >= 100)
// Do something

TIP: You have to make sure there are enough bars before accessing bar n bars ago. If you are on the 1st bar of the chart, there is no bar 5 bars ago for example. To do this you can:

if (CurrentBar < 5)
return;