Forums › ProRealTime forum Français › Support ProBuilder › Ajout de condition pour indicateur Divergence RSI › Reply To: Ajout de condition pour indicateur Divergence RSI
03/24/2023 at 7:13 PM
#212082
Effectivement, en réactivant “and (lastobbar-firstobbar)>=minimalObBars” ça m’enlève pas mal d’erreurs. merci
Par contre c’est la seule fonction qui était désactivée dans le code.
J’ai beau farfouiller, je ne trouve pas d’où provient le reste des erreurs en copie d’écran.
Je souhaiterais également que les divergences soit affichées pendant 5 clôtures (paramètre modifiable) après validation de la cassure du niveau “noLowerThan” pour une divergence baissière et le niveau “noHigherThan” pour une divergence haussière.
Je joint le code du screener
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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
//PRC_AnotherRSIdivergences | indicator //25.02.2019 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge // --- paramètres modifiables RSIp=14 //RSI periode obLevel=70 //Niveau surachat osLevel=30 //Niveau survente minimalObBars=1 //Barres minimales zone survente ou surachat minBarBetween = 6 //Nbr mini de barres divergence maxBarBetween = 26 //Nbr maxi de barres divergence noLowerThan = 59 //Bruit div baissière noHigherThan = 41 //Bruit div haussière // --- end of settings once maxrsi1 = 0 once minrsi1 = 100 irsi = rsi[RSIp] ob = irsi>=obLevel os = irsi<=osLevel divbuy = 0 divsell = 0 //--Initialisation de recherche de divergence baissière-- if irsi < noLowerThan and BearDiv = 0 then maxrsi1 = 0 endif //Identification conditions de divergence baissière if ob then if ob[1]=0 then firstobbar = barindex-1 endif //recherche 1er sommet if irsi > maxrsi1 then maxrsi1=irsi maxprice1=high maxclose1=close maxrsibar1=barindex minrsi12=maxrsi1 maxrsi2=0 endif if maxrsi1>0 then lastobbar = barindex endif Endif //recherche du creux if irsi < maxrsi1 and BearDiv = 0 then minrsi12=min(minrsi12,irsi) If minrsi12<>minrsi12[1] then minprice12=low minclose12=close minrsibar12=barindex maxrsi2=minrsi12 endif endif //recheche 2ème sommet if irsi > minrsi12 then maxrsi2=max(maxrsi2,irsi) If maxrsi2<>maxrsi2[1] then maxprice2=high maxclose2=close maxrsibar2=barindex endif endif //Validation des conditions divergence baissière If maxrsi1 > 0 then barcount=maxrsibar2-maxrsibar1 BearDiv = (maxprice2>maxprice1 or maxclose2>maxclose1) and maxrsi2<maxrsi1 and barcount>=minbarbetween and barcount<=maxbarbetween and maxrsi2>minrsi12 and (lastobbar-firstobbar)>=minimalObBars if BearDiv and irsi < maxrsi2 then RSISellLevel=minrsi12 if irsi<minrsi12 then divsell = 20 // Divergence baissière activée maxrsi1 = 0 // Reset, les div ne se suivent pas BearDiv = 0 endif if (Barindex-maxrsibar2)>12 then //Invalidation divergence si cassure du bruit > 12 bougies maxrsi1 = 0 // Reset, les div ne se suivent pas BearDiv = 0 endif endif Endif //--Initialisation de recherche de divergence haussière-- if irsi > noHigherThan and BullDiv = 0 then minrsi1 = 100 endif //Identification conditions de divergence haussière if os then if os[1]=0 then firstosbar = barindex-1 endif //recherche 1er creux if irsi < minrsi1 then minrsi1=irsi minprice1=low minclose1=close minrsibar1=barindex maxrsi12=minrsi1 minrsi2=100 endif if minrsi1<100 then lastosbar = barindex endif Endif //recherche du sommet if irsi > minrsi1 and BullDiv = 0 then maxrsi12=max(maxrsi12,irsi) If maxrsi12<>maxrsi12[1] then maxprice12=high maxclose12=close maxrsibar12=barindex minrsi2=maxrsi12 endif endif //recherche 2ème creux if irsi < maxrsi12 then minrsi2=min(minrsi2,irsi) If minrsi2<>minrsi2[1] then minprice2=low minclose2=close minrsibar2=barindex endif endif //Validation des conditions divergence haussière If minrsi1 < 100 then barcount=minrsibar2-minrsibar1 BullDiv = (minprice2<minprice1 or minclose2<minclose1) and minrsi2>minrsi1 and barcount>=minbarbetween and barcount<=maxbarbetween and minrsi2 < maxrsi12 and (lastosbar-firstosbar)>=minimalObBars if BullDiv and irsi > minrsi2 then RSIBuyLevel=maxrsi12 if irsi > maxrsi12 then divbuy = 20 // Divergence baissière activée minrsi1 = 100 //Reset, les div ne se suivent pas BullDiv = 0 endif if (Barindex - minrsibar2)>12 then //Invalidation divergence si cassure du bruit > 12 bougies minrsi1 = 100 //Reset, les div ne se suivent pas BullDiv = 0 endif endif Endif screener[divbuy or divsell](max(divbuy,divsell)) |
à l’heure actuelle