Alerte divergence MACD
Forums › ProRealTime forum Français › Support ProBuilder › Alerte divergence MACD
- This topic has 8 replies, 3 voices, and was last updated 9 months ago by Alai-n.
-
-
01/26/2024 at 8:53 PM #226925
Bonjour,
J’ai installé l’indicateur de divergence ci-dessous trouvé dans le forum et je vous en remercie. Es t-il possible de mettre un système d’alerte quand une divergence est détectée ?
https://www.prorealcode.com/prorealtime-indicators/macd-divergences-on-price-and-indicator/
Merci pour votre aide.
01/27/2024 at 2:45 PM #226943Bonjour
alerte non ce n’est pas possible mais les trouver à l’aide d’un détecteur (screener) oui , voir ci après ce screener :
123456789101112131415161718192021222324252627282930313233343536373839404142434445N=40///N is the number of bars to look back for a divergence. Normal values are 20-40. Must be the same in both indicators//using any other indicator is as easy as changing the valuesmiMACD = exponentialAverage[12](close) - exponentialAverage[26](close)signalh=0signalb=0IF (BarIndex > 10+1+N) THEN//we look for bearish divergencesIF (miMACD[1]>miMACD AND miMACD[1]>miMACD[2]) THENextremum2=miMACD[1]extremum1=highest[N](miMACD)preciomax2=close[1]preciomax=Highest[N](close)IF(extremum2<extremum1 AND preciomax2>preciomax[1]) THENfor i=1 to Nif close[i]=preciomax[1] then//zz=isignalb=1endifnextendifendif//we look for bullish divergencesIF (miMACD[1]<miMACD AND miMACD[1]<miMACD[2]) THENextremum22=miMACD[1]extremum11=lowest[N](miMACD)preciomin2=close[1]preciomin=lowest[N](close)IF(extremum22>extremum11 AND preciomin2<preciomin[1]) THENfor i2=1 to Nif close[i2]=preciomin[1] then//zz2=i2signalh=1endifnextendifendifendifscreener [signalh=1 or signalb=1](signalh as "divhaussiere",signalb as "divbaissiere")//////////////////////////////////////////////01/27/2024 at 2:54 PM #226944Merci pour votre retour.
J’aurais aimé mettre l’indicateur MACD zéro retard à la place du MACD dans le code de la divergence.
Savez-vous comment faire ?
Cordialement
01/27/2024 at 5:33 PM #226952ok voici ci après l’indicateur avec macd zéro retard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162///////////////////////////////////////////////////////////// MACD divergences on price//by Jose Callao// twitter @jose7674// attach this indicator to the chartN=40///N is the number of bars to look back for a divergence. Normal values are 20-40. Must be the same in both indicators//using any other indicator is as easy as changing the values// MACD ZERO LAG// p= variable macd zerolag : 12 par défaut// q= variable signal : 26 par défaut// r= variable macd - signal : 9 par défaut // mettre histogrammep = 12q = 26r = 9z1=DEMA[p](close)z2 =dema[q](close)e= z1 - z2z3=DEMA[r](e)f=z3g=e-fmiMACD =g// exponentialAverage[12](close) - exponentialAverage[26](close)IF (BarIndex > 10+1+N) THEN//we look for bearish divergencesIF (miMACD[1]>miMACD AND miMACD[1]>miMACD[2]) THENextremum2=miMACD[1]extremum1=highest[N](miMACD)preciomax2=close[1]preciomax=Highest[N](close)IF(extremum2<extremum1 AND preciomax2>preciomax[1]) THENfor i=1 to Nif close[i]=preciomax[1] thenzz=idrawsegment (barindex[1], mimacd[1], barindex[zz], mimacd[zz]) coloured(200,0,0)endifnextendifendif//we look for bullish divergencesIF (miMACD[1]<miMACD AND miMACD[1]<miMACD[2]) THENextremum22=miMACD[1]extremum11=lowest[N](miMACD)preciomin2=close[1]preciomin=lowest[N](close)IF(extremum22>extremum11 AND preciomin2<preciomin[1]) THENfor i2=1 to Nif close[i2]=preciomin[1] thenzz2=i2drawsegment(barindex[1], close[1], barindex[zz2], close[zz2]) coloured(0,200,0)endifnextendifendifendifreturn miMACD//////////////////////////////////////////////01/27/2024 at 5:46 PM #226954Merci pour votre retour rapide.
Par contre, je n’ai pas les divergences baissières comme pour le MACD. Je vous mets un screen shot où on voit la différence ?
Savez vous pourquoi ?
01/27/2024 at 6:11 PM #226959ok ci après rectifié l’erreur originelle et j’ai rajouté les divergences cachées
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091N=40///N is the number of bars to look back for a divergence. Normal values are 20-40. Must be the same in both indicatorsif close>open thennewclose=closenewopen=openendifif close<= open thennewclose=opennewopen=closeendif//using any other indicator is as easy as changing the values// MACD ZERO LAG// p= variable macd zerolag : 12 par défaut// q= variable signal : 26 par défaut// r= variable macd - signal : 9 par défaut // mettre histogrammep = 12q = 26r = 9z1=DEMA[p](close)z2 =dema[q](close)e= z1 - z2z3=DEMA[r](e)f=z3g=e-fmimacd=g// exponentialAverage[12](close) - exponentialAverage[26](close)IF (mimacd[1]>mimacd AND mimacd[1]>mimacd[2]) THENextremumr2=mimacd[1]extremumr1=highest[N](mimacd)preciomaxr2=close[1]preciomaxr=Highest[N](close)IF(extremumr2<extremumr1 AND preciomaxr2>preciomaxr[1]) THENfor j=1 to Nif mimacd[j]=extremumr1 thenzzr=jdrawsegment (barindex[1], mimacd[1], barindex[zzr], mimacd[zzr])coloured(0,155,0)style(dottedline,2)DRAWPOINT(barindex[1], mimacd[1],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0)DRAWPOINT(barindex[zzr], mimacd[zzr],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0)endifnextendifendifIF (mimacd[1]>mimacd AND mimacd[1]>mimacd[2]) THENrsiextremB2=mimacd[1]rsiextremB1=highest[N](mimacd)rsipmaxB2=close[1]rsipmaxB=Highest[N](close)IF(rsiextremB2=rsiextremB1 AND rsipmaxB2>rsipmaxB[1]) THENfor rsik=1 to Nif close[rsik]=rsipmaxB[1] thenrsizzmB=rsikif newclose[1]<newclose[rsizzmB] thensignalrsi=-2flag=1DRAWTEXT("c",barindex[1], mimacd[1],dialog,bold,10)coloured(0,0,180)drawsegment (barindex[1], mimacd[1], barindex[rsizzmB],mimacd[rsizzmB]) coloured(150,0,0)style(dottedline,1)endifendifnextendifendifIF (mimacd[1]<mimacd AND mimacd[1]<mimacd[2]) THENextremumr22=mimacd[1]extremumr11=lowest[N](mimacd)preciominr2=close[1]preciominr=lowest[N](close)IF(extremumr22>extremumr11 AND preciominr2<preciominr[1]) THENfor j2=1 to Nif mimacd[j2]=extremumr11[1] thenzzr2=j2drawsegment (barindex[1], mimacd[1], barindex[zzr2], mimacd[zzr2])coloured(0,155,0)style(line,2)DRAWPOINT(barindex[1], mimacd[1],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0)DRAWPOINT(barindex[zzr2], mimacd[zzr2],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0)endifnextendifendifIF (mimacd[1]<mimacd AND mimacd[1]<mimacd[2]) THENrsiextremC2=mimacd[1]rsiextremC1=lowest[N](mimacd)rsipminC2=close[1]rsipminC=Lowest[N](close)IF(rsiextremC2=rsiextremC1 AND rsipminC2>rsipminC[1]) THENfor rsil=1 to Nif close[rsil]=rsipminC[1] thenrsizzmC=rsilDRAWTEXT("c",barindex[1], mimacd[1],dialog,bold,10)coloured(0,0,180)drawsegment (barindex[1], mimacd[1], barindex[rsizzmC],mimacd[rsizzmC]) coloured(150,0,0)style(line,1)endifnextendifendifreturn mimacd as "mimacd"01/27/2024 at 6:27 PM #226960prendre celui ci que je viens de réviser//ok ci après rectifié l’erreur originelle et j’ai rajouté les divergences cachées
N=40///N is the number of bars to look back for a divergence. Normal values are 20-40. Must be the same in both indicators
if close>open then
newclose=close
newopen=open
endif
if close<= open then
newclose=open
newopen=close
endif
//using any other indicator is as easy as changing the values
// MACD ZERO LAG
// p= variable macd zerolag : 12 par défaut
// q= variable signal : 26 par défaut
// r= variable macd – signal : 9 par défaut // mettre histogramme
p = 12
q = 26
r = 9
z1=DEMA[p](close)
z2 =dema[q](close)
e= z1 – z2
z3=DEMA[r](e)
f=z3
g=e-f
miMACD =g// exponentialAverage[12](close) – exponentialAverage[26](close)
IF (mimacd[1]>mimacd AND mimacd[1]>mimacd[2]) THEN
extremumr2=mimacd[1]
extremumr1=highest[N](mimacd)
preciomaxr2=close[1]
preciomaxr=Highest[N](close)
IF(extremumr2<extremumr1 AND preciomaxr2>preciomaxr[1]) THEN
for j=1 to N
if mimacd[j]=extremumr1 then
zzr=j
drawsegment (barindex[1], mimacd[1], barindex[zzr], mimacd[zzr])coloured(0,155,0)style(dottedline,2)
DRAWPOINT(barindex[1], mimacd[1],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0)
DRAWPOINT(barindex[zzr], mimacd[zzr],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0)
endif
next
endif
endif
IF (mimacd[1]>mimacd AND mimacd[1]>mimacd[2]) THEN
macdextremB2=mimacd[1]
macdextremB1=highest[N](mimacd)
macdpmaxB2=close[1]
macdpmaxB=Highest[N](close)
IF(macdextremB2=macdextremB1 AND macdpmaxB2>macdpmaxB[1]) THEN
for macdk=1 to N
if close[macdk]=macdpmaxB[1] then
macdzzmB=macdk
if newclose[1]<newclose[macdzzmB] then
signalmacd=-2
flag=1
DRAWTEXT(“c”,barindex[1], mimacd[1],dialog,bold,10)coloured(0,0,180)
drawsegment (barindex[1], mimacd[1], barindex[macdzzmB],mimacd[macdzzmB]) coloured(150,0,0)style(dottedline,1)
endif
endif
next
endif
endif
IF (mimacd[1]<mimacd AND mimacd[1]<mimacd[2]) THEN
extremumr22=mimacd[1]
extremumr11=lowest[N](mimacd)
preciominr2=close[1]
preciominr=lowest[N](close)
IF(extremumr22>extremumr11 AND preciominr2<preciominr[1]) THEN
for j2=1 to N
if mimacd[j2]=extremumr11[1] then
zzr2=j2
drawsegment (barindex[1], mimacd[1], barindex[zzr2], mimacd[zzr2])coloured(0,155,0)style(line,2)
DRAWPOINT(barindex[1], mimacd[1],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0)
DRAWPOINT(barindex[zzr2], mimacd[zzr2],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0)
endif
next
endif
endif
IF (mimacd[1]<mimacd AND mimacd[1]<mimacd[2]) THEN
macdextremC2=mimacd[1]
macdextremC1=lowest[N](mimacd)
macdpminC2=close[1]
macdpminC=Lowest[N](close)
IF(macdextremC2=macdextremC1 AND macdpminC2>macdpminC[1]) THEN
for macdl=1 to N
if close[macdl]=macdpminC[1] then
macdzzmC=macdl
DRAWTEXT(“c”,barindex[1], mimacd[1],dialog,bold,10)coloured(0,0,180)
drawsegment (barindex[1], mimacd[1], barindex[macdzzmC],mimacd[macdzzmC]) coloured(150,0,0)style(line,1)
endif
next
endif
endifreturn mimacd as “mimacd”
01/27/2024 at 7:28 PM #226964Merci pour vos retours rapides.
Je vais regarder ça.
01/31/2024 at 1:41 PM #227173Bonjour,
Pour déclencher des Alertes sonores via la Plateforme, utilisez cette version… Ouvrir le code dans une fenêtre indépendante sous le graphique des prix!
ALERTE DIVERGENCES123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102//ok ci après rectifié l’erreur originelle et j’ai rajouté les divergences cachéesN=40///N is the number of bars to look back for a divergence. Normal values are 20-40. Must be the same in both indicatorsif close>open thennewclose=closenewopen=openendifif close<= open thennewclose=opennewopen=closeendif//using any other indicator is as easy as changing the values// MACD ZERO LAG// p= variable macd zerolag : 12 par défaut// q= variable signal : 26 par défaut// r= variable macd - signal : 9 par défaut // mettre histogrammep = 12q = 26r = 9z1=DEMA[p](close)z2 =dema[q](close)e= z1 - z2z3=DEMA[r](e)f=z3g=e-fmiMACD =g// exponentialAverage[12](close) - exponentialAverage[26](close)///ALERTE = 0///IF (mimacd[1]>mimacd AND mimacd[1]>mimacd[2]) THENextremumr2=mimacd[1]extremumr1=highest[N](mimacd)preciomaxr2=close[1]preciomaxr=Highest[N](close)IF(extremumr2<extremumr1 AND preciomaxr2>preciomaxr[1]) THENfor j=1 to Nif mimacd[j]=extremumr1 thenzzr=j//drawsegment (barindex[1], mimacd[1], barindex[zzr], mimacd[zzr])coloured(0,155,0)style(dottedline,2)//DRAWPOINT(barindex[1], mimacd[1],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0)//DRAWPOINT(barindex[zzr], mimacd[zzr],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0)ALERTE = -1endifnextendifendifIF (mimacd[1]>mimacd AND mimacd[1]>mimacd[2]) THENmacdextremB2=mimacd[1]macdextremB1=highest[N](mimacd)macdpmaxB2=close[1]macdpmaxB=Highest[N](close)IF(macdextremB2=macdextremB1 AND macdpmaxB2>macdpmaxB[1]) THENfor macdk=1 to Nif close[macdk]=macdpmaxB[1] thenmacdzzmB=macdkif newclose[1]<newclose[macdzzmB] thensignalmacd=-2flag=1//DRAWTEXT("c",barindex[1], mimacd[1],dialog,bold,10)coloured(0,0,180)//drawsegment (barindex[1], mimacd[1], barindex[macdzzmB],mimacd[macdzzmB]) coloured(150,0,0)style(dottedline,1)ALERTE = -1endifendifnextendifendifIF (mimacd[1]<mimacd AND mimacd[1]<mimacd[2]) THENextremumr22=mimacd[1]extremumr11=lowest[N](mimacd)preciominr2=close[1]preciominr=lowest[N](close)IF(extremumr22>extremumr11 AND preciominr2<preciominr[1]) THENfor j2=1 to Nif mimacd[j2]=extremumr11[1] thenzzr2=j2//drawsegment (barindex[1], mimacd[1], barindex[zzr2], mimacd[zzr2])coloured(0,155,0)style(line,2)//DRAWPOINT(barindex[1], mimacd[1],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0)//DRAWPOINT(barindex[zzr2], mimacd[zzr2],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0)ALERTE = 1endifnextendifendifIF (mimacd[1]<mimacd AND mimacd[1]<mimacd[2]) THENmacdextremC2=mimacd[1]macdextremC1=lowest[N](mimacd)macdpminC2=close[1]macdpminC=Lowest[N](close)IF(macdextremC2=macdextremC1 AND macdpminC2>macdpminC[1]) THENfor macdl=1 to Nif close[macdl]=macdpminC[1] thenmacdzzmC=macdl//DRAWTEXT("c",barindex[1], mimacd[1],dialog,bold,10)coloured(0,0,180)//drawsegment (barindex[1], mimacd[1], barindex[macdzzmC],mimacd[macdzzmC]) coloured(150,0,0)style(line,1)ALERTE = 1endifnextendifendifreturn ALERTE as "ALERTE"//, mimacd as "mimacd" -
AuthorPosts
Find exclusive trading pro-tools on