Forums › ProRealTime foro Español › Soporte ProBuilder › indicador de divergencia Bollinguer %B › Reply To: indicador de divergencia Bollinguer %B
04/29/2024 at 8:09 AM
#232010
Aqui tienes la divergencia entre el indicador %bollinger y el precio.
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 |
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 //% Bollinger bollUp=BollingerUp[20](close) bollDw=BollingerDown[20](close) Pboll = (close-bolldw)/(bollUp-bollDw )*100 IF (BarIndex > 10+1+N) THEN ///divergencia bajista IF (Pboll[1]>Pboll AND Pboll[1]>Pboll[2]) THEN extremum2=Pboll[1] extremum1=highest[N](Pboll) preciomax2=close[1] preciomax=Highest[N](close) IF(extremum2<extremum1 AND preciomax2>preciomax[1]) THEN for i=1 to N if Pboll[i]=extremum1 then zz=i drawsegment (barindex[1], Pboll[1], barindex[zz], Pboll[zz]) coloured(200,0,0) endif next endif endif ///divergencia alcista IF (Pboll[1]<Pboll AND Pboll[1]<Pboll[2]) THEN extremum22=Pboll[1] extremum11=lowest[N](Pboll) preciomin2=close[1] preciomin=lowest[N](close) IF(extremum22>extremum11 AND preciomin2<preciomin[1]) THEN for i2=1 to N if Pboll[i2]=extremum11[1] then zz2=i2 drawsegment(barindex[1], Pboll[1], barindex[zz2], Pboll[zz2]) coloured(0,200,0) endif next ENDIF ENDIF endif return Pboll as "%Boll", 0 as "0" |