Hello, can You help me to create a screener for Divergence/Convergence detection based on Momentum indicator, please?
Post your topic in the correct forum:
_ ProRealTime Platform Support: only platform related issues.
_ ProOrder: only strategy topics.
_ ProBuilder: only indicator topics.
_ ProScreener: only screener topics
_ General Discussion: any other topics.
_ Welcome New Members: for new forum members to introduce themselves.
I moved it from Probuilder. Thank you 🙂
There you go:
/////////////////////////////////////////////
// Momentum Divergences (based on MACD divergences on MACD by Jose Callao
N=50 //N is the number of bars to look back for a divergence.
P=12
MyMOM = Momentum[P](close)
Signal = 0
IF (BarIndex > P+N) THEN
///divergencia bajista
IF (MyMOM[1]>MyMOM AND MyMOM[1]>MyMOM[2]) THEN
extremum2=MyMOM[1]
extremum1=highest[N](MyMOM)
preciomax2=close[1]
preciomax=Highest[N](close)
IF(extremum2<extremum1 AND preciomax2>preciomax[1]) THEN
for i=1 to N
if MyMOM[i]=extremum1 then
//zz=i
Signal = 2
//drawsegment (barindex[1], MyMOM[1], barindex[zz], MyMOM[zz]) coloured(200,0,0)
endif
next
endif
endif
///divergencia alcista
IF (MyMOM[1]<MyMOM AND MyMOM[1]<MyMOM[2]) THEN
extremum22=MyMOM[1]
extremum11=lowest[N](MyMOM)
preciomin2=close[1]
preciomin=lowest[N](close)
IF(extremum22>extremum11 AND preciomin2<preciomin[1]) THEN
for i2=1 to N
if MyMOM[i2]=extremum11[1] then
//zz2=i2
Signal = 1
//drawsegment(barindex[1], MyMOM[1], barindex[zz2], MyMOM[zz2]) coloured(0,200,0)
endif
next
ENDIF
ENDIF
endif
Screener[Signal](Signal AS "1=↑, 2=↓")