anyone know how this rsi divergence afl works,kindly explain the construction and working .
thank you
amit.
_SECTION_BEGIN("RSI Divergence");
//------------------------------------------------------------------------------
//
// Formula Name: RSI divergence
// Author: Rajandran R
// Url: www.marketcalls.in
// Formula URL:
// Details URL:
//
//------------------------------------------------------------------------------
//
// + scanner
//
//------------------------------------------------------------------------------
/*---------------------------------------------------
RSI Divergence
--------------------------------------------------------*/
GraphXSpace=7;
//n=Param("% Reverse ",12,0,100,1);
n=Optimize("ZIG",20,5,50,1);
per=Optimize("rsi",100,5,50,1);
Buy=Sell=0;
Var = Zig(RSI(per), n);
t= Trough(RSI(per), n, 1);
p= Peak(RSI(per), n, 1);
x[0] =Var[0];
price[0] = C[0];
j=0;
// bearish divergence
for ( i=0; i<BarCount; i++)
{
if(Var == p)
{
j++;
x[j] =Var;
price[j] =C;
if(x[j] <x[j-1] && price[j-1]< price[j])
Sell =1;
}
}
// bullish divergence
for ( i=0; i<BarCount; i++)
{
if(Var == t)
{
j++;
x[j] =Var;
price[j] =C;
if(x[j] >x[j-1] && price[j]<price[j-1])
Buy =1;
}
}
Short=Sell;
Cover=Buy;
Plot(Var, "", 6);
PlotShapes ( IIf(Sell, shapeSmallSquare, shapeNone), colorRed, 0 , Var,0);
PlotShapes( IIf(Buy, shapeSmallSquare, shapeNone), colorBrightGreen, 0, Var,0);
Title ="RSI Divergence" ;
_SECTION_END();
_SECTION_BEGIN("TEMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 200, 1, 10 );
Plot( TEMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
thank you
amit.
_SECTION_BEGIN("RSI Divergence");
//------------------------------------------------------------------------------
//
// Formula Name: RSI divergence
// Author: Rajandran R
// Url: www.marketcalls.in
// Formula URL:
// Details URL:
//
//------------------------------------------------------------------------------
//
// + scanner
//
//------------------------------------------------------------------------------
/*---------------------------------------------------
RSI Divergence
--------------------------------------------------------*/
GraphXSpace=7;
//n=Param("% Reverse ",12,0,100,1);
n=Optimize("ZIG",20,5,50,1);
per=Optimize("rsi",100,5,50,1);
Buy=Sell=0;
Var = Zig(RSI(per), n);
t= Trough(RSI(per), n, 1);
p= Peak(RSI(per), n, 1);
x[0] =Var[0];
price[0] = C[0];
j=0;
// bearish divergence
for ( i=0; i<BarCount; i++)
{
if(Var == p)
{
j++;
x[j] =Var;
price[j] =C;
if(x[j] <x[j-1] && price[j-1]< price[j])
Sell =1;
}
}
// bullish divergence
for ( i=0; i<BarCount; i++)
{
if(Var == t)
{
j++;
x[j] =Var;
price[j] =C;
if(x[j] >x[j-1] && price[j]<price[j-1])
Buy =1;
}
}
Short=Sell;
Cover=Buy;
Plot(Var, "", 6);
PlotShapes ( IIf(Sell, shapeSmallSquare, shapeNone), colorRed, 0 , Var,0);
PlotShapes( IIf(Buy, shapeSmallSquare, shapeNone), colorBrightGreen, 0, Var,0);
Title ="RSI Divergence" ;
_SECTION_END();
_SECTION_BEGIN("TEMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 200, 1, 10 );
Plot( TEMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();