PDA

View Full Version : DI+ and DI- CrossAbove


SamIam
08-31-2007, 11:33 PM
I have been trying to develop a strategy which execute a long position when DI+ crossabove the DI-. Below is my code:

Upon compiling, I have been getting the following error message

if (CrossAbove(DM(Close,20).DiPlus[0],DM(Close,20).DiMinus[0],1))

"The best overloaded method match for 'NinjaTrader.Strategy.StrategyBase.CrossAbove(doub le.NinjaTrader.Data.IDateSeries.int) has some invalid arguments"

Can someone tell me what I have been doing wrong?

Thanks,

Sami

eeisen
08-31-2007, 11:44 PM
I have been trying to develop a strategy which execute a long position when DI+ crossabove the DI-. Below is my code:

Upon compiling, I have been getting the following error message

if (CrossAbove(DM(Close,20).DiPlus[0],DM(Close,20).DiMinus[0],1))

"The best overloaded method match for 'NinjaTrader.Strategy.StrategyBase.CrossAbove(doub le.NinjaTrader.Data.IDateSeries.int) has some invalid arguments"

Can someone tell me what I have been doing wrong?

Thanks,

Sami


You could always just go for a quick fix:

if (DM(20).DiPlus.[1] <= DM(20).DiMinus[1] && DM(20).DiPlus.[0] > DM(20).DiMinus[0]) {execution code;}

NinjaTrader_Dierk
09-01-2007, 03:09 AM
Please try
if (CrossAbove(DM(Close,20).DiPlus,DM(Close,20).DiMin us,1))