[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Code help



PureBytes Links

Trading Reference Links

This is my 2'nd project for the weekend. I am trying to take the standard 
MACD
indicator, and change the alert criteria. Instead of giving an alert when 
crossing 0,I
would like to be alerted as to a divergence between price and the MACD.  I 
am
still new to programming.I have taken the alert from the OBV indicator and
tried incorperating it into the macd. I usually have pretty good luck with 
this but
not with this one. Can anyone tell me why this would work with OBV. but not 
with the
MACD?  It wants me to practically rewrite the whole thing, or if anyone 
would have
an indicator that would accomplish this I would appreciate it!  thanks  john

This is where I started

{Alert Criteria}
If High > Highest(High, 20)[1] AND MACD < Highest(MACD, 20) Then
	Alert("A bearish divergence has been detected")
Else
	If Low < Lowest(Low, 20)[1] AND MACD > Lowest(MACD, 20) Then
		Alert("A bullish divergence has been detected");