pl. correct diversion code

bharatk8

Active Member
#1
I am using following code to plot RSI and OBV diversion.This code misses plotting divergence at some places.Pl. correct it.

RBP = ( ( RSI( 9 ) >= HHV( RSI( 9 ), 9 ) ) AND ( Close < HHV( Close, 9 ) ) ) OR ( ( Close <= LLV( Close, 9 ) ) AND ( RSI( 9 ) > LLV( RSI( 9 ), 9 ) ) );

//RSI -ve
RBN = ( ( RSI( 9 ) <= LLV( RSI( 9 ), 9 ) ) AND ( Close > LLV( Close, 9 ) ) ) OR ( ( Close >= HHV( Close, 9 ) ) AND ( RSI( 9 ) < HHV( RSI( 9 ), 9 ) ) );

//DIGIT 3
//OBV+VE
OBP = ( ( OBV() >= HHV( OBV(), 9 ) AND ( Close < HHV( Close, 9 ) ) ) ) OR ( ( Close <= LLV( Close, 9 ) AND ( OBV() > LLV( OBV(), 9 ) ) ) );

//OBV-VE
OBN = ( ( OBV() <= LLV( OBV(), 9 ) AND ( Close > LLV( Close, 9 ) ) ) ) OR ( ( Close >= HHV( Close, 9 ) AND ( OBV() < HHV( OBV(), 9 ) ) ) );


B2 = RBP;

S2 = RBN;

B3 = OBP;

S3 = OBN;
PlotShapes( B2*shapeDigit2, colorPaleGreen, 0, L, -21 );

PlotShapes( S2*shapeDigit2, colorLightOrange, 0, H, 21 );
PlotShapes( B3*shapeDigit3, colorPaleGreen, 0, L, -24 );

PlotShapes( S3*shapeDigit3, colorLightOrange, 0, H, 24 );
 

Similar threads

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Name:Phone:
Email:City:
State:
Are you a day trader?