[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

% R divergence



PureBytes Links

Trading Reference Links

1. Floating Bars
Using the following technique, you may have "floating bars" for 
Bollinger bands. 
Deleting last pair of /*,*/ you get the limits of Bollinger bands 
envelope.
Deleting the first pair of /*,*/ you get the line of Close .
Note : Do not change the numeration of graphs. The result will not be 
the same.

MAXGRAPH=6;
/*GRAPH0=C;
GRAPH0BARCOLOR=4;*/
GRAPH1=C;
GRAPH1STYLE=64;
GRAPH1BARCOLOR=1;
GRAPH2=bbandbot( close, 20, 2 );
GRAPH2STYLE=2;
GRAPH2BARCOLOR=0;
GRAPH3=bbandtop( close, 20, 2 );
GRAPH3STYLE=2;
GRAPH3BARCOLOR=3;
/*GRAPH4=bbandtop( close, 20, 2 );
GRAPH5=bbandbot( close, 20, 2 );
GRAPH4STYLE=1;
GRAPH5STYLE=1;
GRAPH4BARCOLOR=3;
GRAPH5BARCOLOR=3;*/

2. Williams Divergence
Many times in overbought conditions, %R index begins to fall, leaving 
its (near zero) tops whereas Close price is getting new highs. This 
bearish divergence is frequently a forerunner of a decline. 
Respectively, at the end of a bearish period, %R reacts one or more 
days before price reaches its lowest.
Using the above floating technique, you may have on the same graph %
R, its 9 days EMA, a red 20 units bar when a bearish divergence 
occurred yesterday and a green 20 units bar when a bullish divergence 
took place. 
On the title of the graph you can read %R last value and if any type 
of divergence occurred.
So, you have a lot of info at a glance.

/* %R, ema 9 and divergences */
MAXGRAPH=5;
R=-100*((HHV(HIGH,14)-CLOSE))/(HHV(HIGH,14)-LLV(LOW,14));
DIVR=(R-REF(R,-1))*(C-REF(C,-1));
DIVB=IIF((DIVR<0) AND (R-ref(R,-1))>0 and (REF(R,-1)<-90),-100,0);
DIVB1=IIF((DIVR<0) AND (R-ref(R,-1))>0 and (REF(R,-1)<-90),-80,0);
DIVS=IIF((DIVR<0) AND (R-ref(R,-1))<0 and (REF(R,-1)>-10),-20,0);
GRAPH2=DIVB1;
GRAPH2STYLE=2;
GRAPH2BARCOLOR=0;
graph0 = R;
GRAPH0BARCOLOR=12;
GRAPH1=EMA(R,9);
graph1barcolor=3;
GRAPH2=DIVB1;
GRAPH2STYLE=2;
GRAPH2BARCOLOR=0;
GRAPH4=DIVB;
GRAPH4STYLE=2;
GRAPH3=DIVS;
GRAPH3STYLE=2;
graph4barcolor=8;
graph3barcolor=4;
TITLE=NAME()+" - %R="+writeval(LASTVALUE(R))+
writeif(DIVB==-100," POSITIVE DIVERGENCE"," ")+
WRITEIF(DIVS==-20," NEGATIVE DIVERGENCE","");

>From the moment Amibroker is "feeling" and graphing and listing and 
saving the divergence phenomenon, all the rest is history. In # 2017 
and # 2047 of this mailing company a statistical method was presented 
to help us ascertain the efficiency of divergence appearance for the 
stock we study. If the efficiency for "stock A" is , say 6%, you may 
forget it, if it is 80%, take a closer look, something is going on 
there.

Have a nice day,

Dimitris Tsokakis