gartley patern
Forums › ProRealTime English forum › ProBuilder support › gartley patern
- This topic has 0 replies, 1 voice, and was last updated 2 weeks ago by
LucasBest.
Viewing 1 post (of 1 total)
-
-
10/08/2025 at 5:28 PM #252359gartley patern Detection123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151//---InitialisationOnce init = 1Once marge = 0.2 // 2% de marge d'erreurIf init = 1 thenFor wl = 0 to 30 do$Newlow[wl] = 0$Newhigh[wl] = 0$LastTurningPoint[wl] = 0$Top1x[wl] = 0$Top2x[wl] = 0$Top3x[wl] = 0$Bot1x[wl] = 0$Bot2x[wl] = 0$Bot3x[wl] = 0Nextinit = 0Endif//---Zigzag points detectionFor wl = 5 to 21 do//If wl = 14 then //wl = 7 orATR = averagetruerange[wl](close)IF barindex >= 2*wl+1 thenif high[wl] >= highest[2*wl+1](high) and $LastTurningPoint[wl]<=0 and $Newlow[wl]=0 then$NewHigh[wl] = 1If $Top2x[wl] <> 0 then$Top1x[wl] = $Top2x[wl]EndifIf $Top3x[wl] <> 0 then$Top2x[wl] = $Top3x[wl]Endif$Top3x[wl] = barindex[wl]$LastTurningPoint[wl]= 1else$NewHigh[wl] = 0endifif low[wl] <= lowest[2*wl+1](low) and $LastTurningPoint[wl]>=0 and $NewHigh[wl]=0 then$NewLow[wl] = 1If $Bot2x[wl] <> 0 then$Bot1x[wl] = $Bot2x[wl]EndifIf $Bot3x[wl] <> 0 then$Bot2x[wl] = $Bot3x[wl]Endif$Bot3x[wl] = barindex[wl]$LastTurningPoint[wl]= -1else$NewLow[wl] = 0endifEndif//endifNext//--- Gartley aka 222 pattern detectionFor wl = 2 to 56 do//If wl = 14 then //wl = 7 or// A-t'on 4 points ?If $Top2x[wl] <> 0 and $Bot2x[wl] <> 0 and (barindex-Max($Top3x[wl],$Bot3x[wl])) >= wl thenDelta = Close / 500 // Delta à 0.20%If $Top2x[wl] > $Bot2x[wl] then// Possible Gartley pattern haussier ?PtxX = $Bot2x[wl]PtyX = low[barindex-PtxX]PtxA = $Top2x[wl]PtyA = High[barindex-PtxA]PtxB = $Bot3x[wl]PtyB = low[barindex-PtxB]PtxC = $Top3x[wl]PtyC = High[barindex-PtxC]XA = PtyA - PtyXAB = PtyA - PtyBBC = PtyC - PtyBCD = PtyC - LowIf (AB >= XA*0.618*(1-marge) and AB <= XA*0.618*(1+marge)) and ((BC >= AB*0.382*(1-marge) and BC <= AB*0.382*(1+marge) and CD >= BC*1.272*(1-marge) and CD <= BC*1.272*(1+marge)) or (BC >= AB*0.886*(1-marge) and BC <= AB*0.886*(1+marge) and CD >= BC*1.618*(1-marge) and CD <= BC*1.618*(1+marge))) and (CD >= XA*0.786*(1-marge) and CD <= XA*0.786*(1+marge)) and PtyX = Lowest[PtxB-PtxX+1](Low[barindex-PtxB]) and Low = Lowest[Barindex-PtxB+1](Low) then// 5ème point potentiel trouvé = BarindexPtxD = BarindexPtyD = Lowdrawtriangle(PtxX,PtyX,PtxA,PtyA,PtxB,PtyB) coloured("deepskyblue",75) bordercolor("deepskyblue",200)drawtriangle(PtxB,PtyB,PtxC,PtyC,PtxD,PtyD) coloured("deepskyblue",150) bordercolor("deepskyblue",200)EndifEndifIf $Top2x[wl] < $Bot2x[wl] then// Possible Gartley pattern baissier ?PtxX = $Top2x[wl]PtyX = High[barindex-PtxX]PtxA = $Bot2x[wl]PtyA = Low[barindex-PtxA]PtxB = $Top3x[wl]PtyB = High[barindex-PtxB]PtxC = $Bot3x[wl]PtyC = Low[barindex-PtxC]XA = PtyX - PtyAAB = PtyB - PtyABC = PtyB - PtyCCD = High - PtyCIf (AB >= XA*0.618*(1-marge) and AB <= XA*0.618*(1+marge)) and ((BC >= AB*0.382*(1-marge) and BC <= AB*0.382*(1+marge) and CD >= BC*1.272*(1-marge) and CD <= BC*1.272*(1+marge)) or (BC >= AB*0.886*(1-marge) and BC <= AB*0.886*(1+marge) and CD >= BC*1.618*(1-marge) and CD <= BC*1.618*(1+marge))) and (CD >= XA*0.786*(1-marge) and CD <= XA*0.786*(1+marge)) and PtyX = Highest[PtxB-PtxX+1](High[barindex-PtxB]) and High = Highest[Barindex-PtxB+1](High) then// 5ème point potentiel trouvé = BarindexPtxD = BarindexPtyD = Highdrawtriangle(PtxX,PtyX,PtxA,PtyA,PtxB,PtyB) coloured("Red",75) bordercolor("Red",200)drawtriangle(PtxB,PtyB,PtxC,PtyC,PtxD,PtyD) coloured("Red",150) bordercolor("Red",200)EndifEndifEndif//EndifNextReturn
2 users thanked author for this post.
-
AuthorPosts
Viewing 1 post (of 1 total)