PDA

View Full Version : How to write second cross over of MACD?


Jenny
07-17-2007, 07:53 PM
How to write second cross above of MACD? And the second cross over is higher than the first one?
Thanks a lot

NinjaTrader_Josh
07-17-2007, 10:30 PM
This is not exactly ninjascript code, but it gives you a general outline of how to write the code.

double macdvalue
int firstcross

if macd crossabove signal line <--or whatever condition you were trying for
{
if firstcross == 1 && current macd's value > macdvalue
{
blah blah do something
macdvalue = 0
firstcross = 0
}
else
{
macdvalue = macd's crossover value
firstcross = 1
}
}

Jenny
07-18-2007, 06:23 AM
Thank you!