View Full Version : Adding Offset for a SMA
Edgar V.
03-20-2008, 11:55 AM
Can't find how to translate the following statement into Ninja Script:
if SMA=10 + 5 Ticks CrossAbove SMA=20;
//Do Something...
NinjaTrader_Ray
03-20-2008, 12:04 PM
You could try
if (CrossBelow(SMA(20), SMA(10)[0] + 5 * TickSize, 1))
// Do something
Edgar V.
03-20-2008, 12:15 PM
Works. Thanks!
Edgar V.
03-20-2008, 12:32 PM
Wrong Call from me. Isn't working. behaves as if there was no "+ 5 * TickSize". Seems that Offset doesn't work with Crossovers. I'll have to work around it.
NinjaTrader_Josh
03-20-2008, 09:55 PM
It should work. Check the values by printing SMA(10)[0] + 5 * TickSize right before the if statement and also print it in the if statement.