This is an indicator that shows divergences on price and MACD and RSI and MFI at the same time.
you need to put 1 indicator on the price chart and another as a new indicator.
Divergences are drawn automatically and it does not repaint.
Thanks to José CALLAO
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
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 //using any other indicator is as easy as changing the values miMACD = exponentialAverage[12](close)-exponentialAverage[26](close) miRSI = RSI[14](close) mimfi = MoneyFlowIndex[14] IF (BarIndex > 10+1+N) THEN IF (miMACD[1]>miMACD AND miMACD[1]>miMACD[2]) THEN extremum2=miMACD[1] extremum1=highest[N](miMACD) preciomax2=close[1] preciomax=Highest[N](close) IF(extremum2<extremum1 AND preciomax2>preciomax[1]) THEN for i=1 to N if close[i]=preciomax[1] then zzm=i if divmacd then drawsegment (barindex[1], close[1], barindex[zzm],close[zzm]) coloured(0,0,155)style(dottedline,2) endif endif next endif endif IF (miMACD[1]<miMACD AND miMACD[1]<miMACD[2]) THEN extremum22=miMACD[1] extremum11=lowest[N](miMACD) preciomin2=close[1] preciomin=lowest[N](close) IF(extremum22>extremum11 AND preciomin2<preciomin[1]) THEN for i2=1 to N if close[i2]=preciomin[1] then zzm2=i2 if divmacd then drawsegment(barindex[1], close[1], barindex[zzm2], close[zzm2]) coloured(0,0,155)style(line,2) endif endif next endif endif IF (miRSI[1]>miRSI AND miRSI[1]>miRSI[2]) THEN extremumr2=miRSI[1] extremumr1=highest[N](miRSI) preciomaxr2=close[1] preciomaxr=Highest[N](close) IF(extremumr2<extremumr1 AND preciomaxr2>preciomaxr[1]) THEN for j=1 to N if close[j]=preciomaxr[1] then zzr=j if divrsi then drawsegment (barindex[1], close[1], barindex[zzr], close[zzr]) coloured(0,155,0)style(dottedline,2) endif endif next endif endif IF (miRSI[1]<miRSI AND miRSI[1]<miRSI[2]) THEN extremumr22=miRSI[1] extremumr11=lowest[N](miRSI) preciominr2=close[1] preciominr=lowest[N](close) IF(extremumr22>extremumr11 AND preciominr2<preciominr[1]) THEN for j2=1 to N if close[j2]=preciominr[1] then zzr2=j2 if divrsi then drawsegment(barindex[1], close[1], barindex[zzr2], close[zzr2]) coloured(0,155,0)style(line,2) endif endif next endif endif IF (mimfi[1]>mimfi AND mimfi[1]>mimfi[2]) THEN extremummfi2=mimfi[1] extremummfi1=highest[N](mimfi) preciomaxmfi2=close[1] preciomaxmfi=Highest[N](close) IF(extremummfi2<extremummfi1 AND preciomaxmfi2>preciomaxmfi[1]) THEN for k=1 to N if close[k]=preciomaxmfi[1] then zzmfi=k if divmfi then drawsegment(barindex[1], close[1], barindex[zzmfi2], close[zzmfi2]) coloured(155,0,0)style(dottedline,1) endif endif next endif endif IF (mimfi[1]<mimfi AND mimfi[1]<mimfi[2]) THEN extremummfi22=mimfi[1] extremummfi11=lowest[N](mimfi) preciominmfi2=close[1] preciominmfi=lowest[N](close) IF(extremummfi22>extremummfi11 AND preciominmfi2<preciominmfi[1]) THEN for k2=1 to N if close[k2]=preciominmfi[1] then zzmfi2=k2 if divmfi then drawsegment(barindex[1], close[1],barindex[zzmfi2], close[zzmfi2]) coloured(155,0,0)style(line,3) endif endif next endif endif endif if islastbarupdate then DRAWTEXT("Bleu:macd",barindex+6,low-0.025*low,dialog,standard,10)coloured(0,0,155) DRAWTEXT("Vert:rsi",barindex+6,low-0.05*low,dialog,standard,10)coloured(0,155,0) DRAWTEXT("Rouge:mfi",barindex+6,low-0.075*low,dialog,standard,10)coloured(255,0,0) endif return |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
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 miMACD = exponentialAverage[12](close)-exponentialAverage[26](close) mirsi = RSI[14](close) miOBV = OBV(close) mimfi=MoneyFlowIndex[14] IF (BarIndex > 10+1+N) THEN IF (miMACD[1]>miMACD AND miMACD[1]>miMACD[2]) THEN extremum2=miMACD[1] extremum1=highest[N](miMACD) preciomax2=close[1] preciomax=Highest[N](close) IF(extremum2<extremum1 AND preciomax2>preciomax[1]) THEN for i=1 to N if mimacd[i]=extremum1 then zzm=i if divmacd then drawsegment (barindex[1], mimacd[1],barindex[zzm], mimacd[zzm])coloured(0,0,155)style(dottedline,2) DRAWPOINT(barindex[1], mimacd[1],1)coloured(0,0,155,100) DRAWPOINT(barindex[zzm], mimacd[zzm],1)coloured(0,0,155,100) endif endif next endif endif IF (miMACD[1]<miMACD AND miMACD[1]<miMACD[2]) THEN extremum22=miMACD[1] extremum11=lowest[N](miMACD) preciomin2=close[1] preciomin=lowest[N](close) IF(extremum22>extremum11 AND preciomin2<preciomin[1]) THEN for i2=1 to N if mimacd[i2]=extremum11[1] then zzm2=i2 if divmacd then drawsegment(barindex[1], mimacd[1], barindex[zzm2], mimacd[zzm2])coloured(0,0,155)style(line,2) DRAWPOINT(barindex[1], mimacd[1],1)coloured(0,0,155,100) DRAWPOINT(barindex[zzm2], mimacd[zzm2],1)coloured(0,0,155,100) endif endif next endif endif ////////////////////////////////////////////////// IF (mirsi[1]>mirsi AND mirsi[1]>mirsi[2]) THEN extremumr2=mirsi[1] extremumr1=highest[N](mirsi) preciomaxr2=close[1] preciomaxr=Highest[N](close) IF(extremumr2<extremumr1 AND preciomaxr2>preciomaxr[1]) THEN for j=1 to N if mirsi[j]=extremumr1 then zzr=j if divrsi then drawsegment (barindex[1], mirsi[1], barindex[zzr], mirsi[zzr])coloured(0,155,0)style(dottedline,2) DRAWPOINT(barindex[1], mirsi[1],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0) DRAWPOINT(barindex[zzr], mirsi[zzr],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0) endif endif next endif endif IF (mirsi[1]<mirsi AND mirsi[1]<mirsi[2]) THEN extremumr22=mirsi[1] extremumr11=lowest[N](mirsi) preciominr2=close[1] preciominr=lowest[N](close) IF(extremumr22>extremumr11 AND preciominr2<preciominr[1]) THEN for j2=1 to N if mirsi[j2]=extremumr11[1] then zzr2=j2 if divrsi then drawsegment (barindex[1], mirsi[1], barindex[zzr2], mirsi[zzr2])coloured(0,155,0)style(line,2) DRAWPOINT(barindex[1], mirsi[1],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0) DRAWPOINT(barindex[zzr2], mirsi[zzr2],1)coloured(0,155,0,0)BORDERCOLOR(0,155,0) endif endif next endif endif /////////////////////////////////////////////////// IF (mimfi[1]>mimfi AND mimfi[1]>mimfi[2]) THEN extremummfi2=mimfi[1] extremummfi1=highest[N](mimfi) preciomaxmfi2=close[1] preciomaxmfi=Highest[N](close) IF(extremummfi2<extremummfi1 AND preciomaxmfi2>preciomaxmfi[1]) THEN for k=1 to N if mimfi[k]=extremumr1 then zzmf=k if divmfi then drawsegment (barindex[1], mimfi[1], barindex[zzmf], mimfi[zzmf])coloured(155,0,0)style(dottedline,2) DRAWPOINT(barindex[1], mimfi[1],1)coloured(255,255,255,0)BORDERCOLOR(155,0,0) DRAWPOINT(barindex[zzmf], mimfi[zzmf],1)coloured(255,255,255,0)BORDERCOLOR(155,0,0) endif endif next endif endif IF (mimfi[1]<mimfi AND mimfi[1]<mimfi[2]) THEN extremummfi22=mimfi[1] extremummfi11=lowest[N](mimfi) preciominmfi2=close[1] preciominmfi=lowest[N](close) IF(extremummfi22>extremummfi11 AND preciominmfi2<preciominmfi[1]) THEN for k2=1 to N if mimfi[k2]=extremummfi11[1] then zzmf2=k2 if divmfi then drawsegment (barindex[1], mimfi[1], barindex[zzmf2], mimfi[zzmf2])coloured(155,0,0)style(line,2) DRAWPOINT(barindex[1], mimfi[1],1)coloured(255,255,255,0)BORDERCOLOR(155,0,0) DRAWPOINT(barindex[zzmf2], mimfi[zzmf2],1)coloured(255,255,255,0)BORDERCOLOR(155,0,0) endif endif next endif endif endif if islastbarupdate then DRAWTEXT("Bleu:macd",barindex+6,20,dialog,standard,10)coloured(0,0,155) DRAWTEXT("Vert:rsi",barindex+6,10,dialog,standard,10)coloured(0,155,0) DRAWTEXT("Rouge:mfi",barindex+6,0,dialog,standard,10)coloured(255,0,0) endif return mimacd as "MACD",mirsi as "RSI",mimfi as"MFI" |
.
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Thank you very much for sharing the indicators
it’s amazing work,
The MACD is not showing clearly
It looks like a line
Hello IASD
it’s normal , when this occurs, uncheck RSI and MFI line and click then the MACD is showing clearly
Thank you very much for sharing!
estoy de acuerdo con IASD
Esta muy bien
el MAD y el indicador en el precio no se ven bien, creo que es una cuestion de escalas
gracias Jacques