trying to code a script to draw a line on MACD crossover. Skipping crossovers.
dasilvja: It seemed to work except that it skips some of the crossovers. Plus there are some lines drawn in where I don't see any crossovers. Any thoughts?
double signalLineLast = iMACD(NULL,0,12,26,9,PRICE_CLOSE,1,i+1); if(MACD>signalLine && MACDLast<signalLine )
Why don't you compare last to last?
William Roeder:
Omg... I didn't even realize it was like that! I'm such a goof. Thanks. It works now. lol
Why don't you compare last to last?
I am trying to do this with the current version on Sierra Chart, could someone help me with this?
I'm just learning to code. I'm just trying to write a script right now. I want to draw a blue vertical line whenever the MACD line crosses up over the signal line and draw a red vertical line when it crosses down. It seemed to work except that it skips some of the crossovers. Plus there are some lines drawn in where I don't see any crossovers. Any thoughts?