Aquí os dejo una solicitud recibida por ProRealTime, se trata de un screener de divergencias entre el precio y el MACD
Hi,
I would like to get a proscreener that detects divergencies between the prize and the macd indicator.
If it is possible not only in day trading if not in 3 hour, 2 hours, 1 hour….. I mean in different temporal moments
Thank you so much
Y aquí una proposición de respuesta:
res=0
DivergencePeriod=20
myMACDSignal=MACD[12,26,9](close)
if close < lowest[DivergencePeriod](close[1]) and myMACDSignal > lowest[DivergencePeriod](myMACDSignal[1]) then
res=1
endif
if close > highest[DivergencePeriod](close[1]) and myMACDSignal < highest[DivergencePeriod](myMACDSignal[1]) then
res=-1
endif
screener[res=1 or res=-1]