Divergences SMI and CCI
Forums › ProRealTime English forum › ProBuilder support › Divergences SMI and CCI
- This topic has 8 replies, 3 voices, and was last updated 4 years ago by Matriciel.
Tagged: Cci, divergences, smi
-
-
01/11/2020 at 10:00 PM #116463
I was inspired by the “Another RSI Divergence Indicator by Nicolas. The same idee has applied to the SMI and to the CCI indicators.
Another Divergence SMI Indicator1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374OverboughtLevel are not 70 and 30 RSI but 40 and -40 for SMI and 100 and -100 for CCI.And as you can see the RSI is replaced by the SMI and the CCI respectively.// Settings for SMI DivergenceobLevel=40 //overbought levelosLevel=-40 //oversold levelminimalBars=5 //minimal count of bars where CCI is ob or os// End of settingsiSMi =SMI[14,3,5](close)ob = iSMi>obLevelos = iSMi<osLevelif ob thenif not ob[1] thenmaxSMi = 0maxprice = 0firstobbar = barindexendifmaxSMi=max(maxSMi,ISMI)maxprice=max(maxprice,high)if maxSMi<>maxSMi[1] thenmaxSMibar=barindexendifendifif os thenif not os[1] thenminSMi = 100minprice = close*100firstosbar = barindexendifminSMi=min(minSMi,ISMI)minprice=min(minprice,low)if minSMi<>minSMi[1] thenminSMibar=barindexendifendifdivsell=0if ISMI crosses under obLevel then//verif divergencediv = maxprice>oldmaxprice and maxSMi<oldmaxSMi and (barindex-firstobbar)>=minimalBarsif div thendrawsegment(oldmaxSMibar,oldmaxSMi,maxSMibar,maxSMi) coloured(200,0,0)drawarrowdown(maxSMibar,maxSMi) coloured(200,0,0)DRAWVLINE(barindex)coloured(200,120,0,255)divsell=osLevelendifoldmaxSMi = maxSMioldmaxprice = maxpriceoldmaxSMibar = maxSMibarendifdivbuy=0if iSMI crosses over osLevel then//verif divergencediv = minprice<oldminprice and minSMi>oldminSMi and (barindex-firstosbar)>=minimalBarsif div thendrawsegment(oldminSMibar,oldminSMi,minSMibar,minSMi) coloured(0,120,200)drawarrowup(minSMibar,minSMi) coloured(0,120,200)DRAWVLINE(barindex)coloured(0,120,200,255)divbuy=osLevelendifoldminSMi = minSMioldminprice = minpriceoldminSMibar = minSMibarendifreturn iSMI style(line,2) as "SMI",obLevel coloured(168,168,168) style(dottedline,2) as "overbought level", osLevel coloured(168,168,168) style(dottedline,1) as "oversold level", divsell coloured(200,0,0), divbuy coloured(0,200,0)Another Divergence SMI Indicator123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869// Settings for CCI DivergenceobLevel=40 //overbought levelosLevel=-40 //oversold levelminimalBars=5 //minimal count of bars where CCI is ob or os// End of settingsiSMi =SMI[14,3,5](close)ob = iSMi>obLevelos = iSMi<osLevelif ob thenif not ob[1] thenmaxSMi = 0maxprice = 0firstobbar = barindexendifmaxSMi=max(maxSMi,ISMI)maxprice=max(maxprice,high)if maxSMi<>maxSMi[1] thenmaxSMibar=barindexendifendifif os thenif not os[1] thenminSMi = 100minprice = close*100firstosbar = barindexendifminSMi=min(minSMi,ISMI)minprice=min(minprice,low)if minSMi<>minSMi[1] thenminSMibar=barindexendifendifdivsell=0if ISMI crosses under obLevel then//verif divergencediv = maxprice>oldmaxprice and maxSMi<oldmaxSMi and (barindex-firstobbar)>=minimalBarsif div thendrawsegment(oldmaxSMibar,oldmaxSMi,maxSMibar,maxSMi) coloured(200,0,0)drawarrowdown(maxSMibar,maxSMi) coloured(200,0,0)DRAWVLINE(barindex)coloured(200,120,0,255)divsell=osLevelendifoldmaxSMi = maxSMioldmaxprice = maxpriceoldmaxSMibar = maxSMibarendifdivbuy=0if iSMI crosses over osLevel then//verif divergencediv = minprice<oldminprice and minSMi>oldminSMi and (barindex-firstosbar)>=minimalBarsif div thendrawsegment(oldminSMibar,oldminSMi,minSMibar,minSMi) coloured(0,120,200)drawarrowup(minSMibar,minSMi) coloured(0,120,200)DRAWVLINE(barindex)coloured(0,120,200,255)divbuy=osLevelendifoldminSMi = minSMioldminprice = minpriceoldminSMibar = minSMibarendifreturn iSMI style(line,2) as "SMI",obLevel coloured(168,168,168) style(dottedline,2) as "overbought level", osLevel coloured(168,168,168) style(dottedline,1) as "oversold level", divsell coloured(200,0,0), divbuy coloured(0,200,0)2 users thanked author for this post.
01/11/2020 at 10:02 PM #11646501/12/2020 at 12:57 PM #116497The code for the CCI Divergence is missing in my earlier posts, therfore I try again:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768// Settings for CCI DivergenceCCIp=28 //CCI periodobLevel=100 //overbought levelosLevel=-100 //oversold levelminimalBars=5 //minimal count of bars where CCI is ob or os// End of settingsicci = cci[ccIp]ob = icci>obLevelos = icci<osLevelif ob thenif not ob[1] thenmaxcci = 0maxprice = 0firstobbar = barindexendifmaxcci=max(maxcci,icci)maxprice=max(maxprice,high)if maxcci<>maxcci[1] thenmaxccibar=barindexendifendifif os thenif not os[1] thenmincci = 100minprice = close*100firstosbar = barindexendifmincci=min(mincci,icci)minprice=min(minprice,low)if mincci<>mincci[1] thenminccibar=barindexendifendifdivsell=0if icci crosses under obLevel then//verif divergencediv = maxprice>oldmaxprice and maxcci<oldmaxcci and (barindex-firstobbar)>=minimalBarsif div thendrawsegment(oldmaxccibar,oldmaxcci,maxccibar,maxcci) coloured(200,0,0)drawarrowdown(maxccibar,maxcci) coloured(200,0,0)DRAWVLINE(barindex)coloured(200,120,0,255)divsell=osLevelendifoldmaxcci = maxccioldmaxprice = maxpriceoldmaxccibar = maxccibarendifdivbuy=0if icci crosses over osLevel then//verif divergencediv = minprice<oldminprice and mincci>oldmincci and (barindex-firstosbar)>=minimalBarsif div thendrawsegment(oldminccibar,oldmincci,minccibar,mincci) coloured(0,120,200)drawarrowup(minccibar,mincci) coloured(0,120,200)DRAWVLINE(barindex)coloured(0,120,200,255)divbuy=osLevelendifoldmincci = minccioldminprice = minpriceoldminccibar = minccibarendifreturn icci style(line,2) as "CCI",obLevel coloured(168,168,168) style(dottedline,1) as "overbought level", osLevel coloured(168,168,168) style(dottedline,1) as "oversold level", divsell coloured(200,0,0), divbuy coloured(0,200,0)1 user thanked author for this post.
01/12/2020 at 1:07 PM #11650101/13/2020 at 11:16 AM #11661303/05/2020 at 2:55 PM #121259The oblevel (50)and the oslevel(-50) for CCI in a 4h graphic give good results
The oblevel (60) and oslevel(40) for RSI in a 4h graphic
The Oblevel (40) and Oslevel(-40) for SMI in a 4h graphic.
Thes levels are comparable to each other. The code changes are below for the CCI and similar for RSI and SMI.
Little changes in the code123DRAWRECTANGLE(barindex, High+8*AverageTrueRange[14](close), barindex[1], low[1]-0.618*AverageTrueRange[14](close))coloured(125,255,125,255)DRAWTEXT("Start Div CCI Up", barindex, Low-4.23*AverageTrueRange[14](close))coloured(125,255,125,255)DRAWARROWUP(barindex, low-2.618*AverageTrueRange[14](close))coloured(125,255,125,255)1 user thanked author for this post.
03/05/2020 at 2:58 PM #121263The complete code for Div.CCI 2.0:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172// Settings for CCI DivergenceCCIp=29 //CCI periodobLevel=50 //overbought levelosLevel=-50 //oversold levelminimalBars=10 //minimal count of bars where CCI is ob or os// End of settingsicci = cci[ccIp]ob = icci>obLevelos = icci<osLevelif ob thenif not ob[1] thenmaxcci = 0maxprice = 0firstobbar = barindexendifmaxcci=max(maxcci,icci)maxprice=max(maxprice,high)if maxcci<>maxcci[1] thenmaxccibar=barindexendifendifif os thenif not os[1] thenmincci = 50minprice = close*50firstosbar = barindexendifmincci=min(mincci,icci)minprice=min(minprice,low)if mincci<>mincci[1] thenminccibar=barindexendifendifdivsell=0if icci crosses under obLevel then//verif divergencediv = maxprice>oldmaxprice and maxcci<oldmaxcci and (barindex-firstobbar)>=minimalBarsif div thendrawsegment(oldmaxccibar,oldmaxcci,maxccibar,maxcci) coloured(200,0,0)drawarrowdown(maxccibar,maxcci) coloured(200,0,0)DRAWRECTANGLE(barindex, High+0.618*AverageTrueRange[14](close), barindex[1], low[1]-8*AverageTrueRange[14](close))coloured(255,20,0,255)DRAWTEXT("Start Div CCI Down", barindex, High+4.23*AverageTrueRange[14](close))coloured(255,120,120,255)DRAWARROWDOWN(barindex, high+2.618*AverageTrueRange[14](close))coloured(255,120,120,255)divsell=oslevelendifoldmaxcci = maxccioldmaxprice = maxpriceoldmaxccibar = maxccibarendifdivbuy=0if icci crosses over osLevel then//verif divergencediv = minprice<oldminprice and mincci>oldmincci and (barindex-firstosbar)>=minimalBarsif div thendrawsegment(oldminccibar,oldmincci,minccibar,mincci) coloured(0,120,200)drawarrowup(minccibar,mincci) coloured(0,120,200)DRAWRECTANGLE(barindex, High+8*AverageTrueRange[14](close), barindex[1], low[1]-0.618*AverageTrueRange[14](close))coloured(125,255,125,255)DRAWTEXT("Start Div CCI Up", barindex, Low-4.23*AverageTrueRange[14](close))coloured(125,255,125,255)DRAWARROWUP(barindex, low-2.618*AverageTrueRange[14](close))coloured(125,255,125,255)divbuy=osLevelendifoldmincci = minccioldminprice = minpriceoldminccibar = minccibarendifreturn icci style(line,2) as "CCI",obLevel coloured(168,168,168) style(dottedline,1) as "overbought level", osLevel coloured(168,168,168) style(dottedline,1) as "oversold level", divsell coloured(200,0,0), divbuy coloured(0,200,0),01 user thanked author for this post.
03/05/2020 at 3:41 PM #121266I like to discuss the three divergencies, I will give the exacttime for the different signals:
-
- div. up SMI 3/2/2020 at 9 PM
- div up CCI 4/2/2020 at 5 AM
- div up RSI 30/1/2020 at 9 PM
- div down SMI one at 13/2/2020 at 9 PM and one at 18/2/2020 at 5 AM
- div down CCI 18/2/2020 at 9 PM
- div down RSI 17/2/2020 at 9
Oblevels and Oslevels
1. SMI 40 and -40
2. CCI 50 and – 50
3. RSI 60 and 40
One can also use the divergenties in smaller time frames. In the attachement there are all three divergencies visible
1 user thanked author for this post.
03/06/2020 at 9:21 AM #121317 -
-
AuthorPosts