Divergence William%R
- This topic has 2 replies, 2 voices, and was last updated 4 years ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
Forums › ProRealTime English forum › ProBuilder support › Divergence William%R
Hello everyone,
Can you help me for this.
For the indicator William%R, i have the code like this
There you go:
|
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 |
/////////////////////////////////////////////////////////// ONCE NumberOfBars = 40 ONCE WRperiods = 14 ONCE Distance = 25 * pipsize // ONCE NumberOfBars = max(1,min(999,NumberOfBars)) ONCE WRperiods = max(1,min(999,WRperiods)) ONCE Distance = Distance * PipSize // r = 255 g = 0 b = 0 t = 255 // src = CustomClose // hh = highest[WRperiods](high) ll = lowest[WRperiods](low) WR = ((hh-src)/(hh-ll))*-100 // IF (BarIndex > (WRperiods + NumberOfBars)) THEN // Divergenza Ribassista IF (WR[1] > WR) AND (WR[1] > WR[2]) THEN extremum2=WR[1] extremum1=highest[NumberOfBars](WR) Prezzomax2=src[1] Prezzomax=Highest[NumberOfBars](src) IF(extremum2 < extremum1) AND (Prezzomax2 > Prezzomax[1]) THEN FOR i = 1 TO NumberOfBars if WR[i] = extremum1 then zz = i drawsegment (barindex[1], WR[1]+Distance, barindex[zz], WR[zz]+Distance) coloured(r,g,b,t) endif next endif endif // Divergenza Rialzista IF (WR[1] < WR) AND (WR[1]<WR[2]) THEN extremum22 = WR[1] extremum11 = lowest[NumberOfBars](WR) Prezzomin2 = src[1] Prezzomin = lowest[NumberOfBars](src) IF(extremum22 > extremum11) AND (Prezzomin2 < Prezzomin[1]) THEN FOR i2 = 1 TO NumberOfBars if WR[i2] = extremum11[1] then zz2 = i2 r = 0 g = 0 b = 255 drawsegment(barindex[1], WR[1]-Distance, barindex[zz2], WR[zz2]-Distance) coloured(r,g,b,t) endif next ENDIF ENDIF endif return WR as "Willimas R%"//, 0 as "0" |
You can change the NumerOfBars to scan a bar range, WRperiods and and Distance of lines from the price.
If you import the ITF file you will have variables declared.