Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

RSI divergence for Amibroker (AFL)

Rating:
3 / 5 (Votes 4)
Tags:
oscillator, amibroker

You can change the parameters of the RSI.

Similar Indicators / Formulas

3 Days Track
Submitted by janet0211 over 14 years ago
Trading Volume Statistic
Submitted by tuanstock1 over 10 years ago
Ergodic Oscillator
Submitted by dljtrader about 14 years ago
BoH Risk Aversion Indicator
Submitted by genkumag about 13 years ago
Chande Momentum Oscillator
Submitted by klimpek about 14 years ago
%R ++
Submitted by reb over 14 years ago

Indicator / Formula

Copy & Paste Friendly
// RSI divergence
// Backgraund color White


P = Param("Priod RSI", 14, 2, 14, 1);
VRSI = RSI(P);

Length = 100; 
Lapse = 3; 

fUp = VRSI > Ref(VRSI, -1) & VRSI > Ref(VRSI, 1) & VRSI >55;
fDown = VRSI < Ref(VRSI, -1) & VRSI < Ref(VRSI, 1) & VRSI < 45;

Div = 0;

for(i = Length; i < BarCount; i++)
{


// Down
if(fUp[i])
{
k = i-1;
do
{
if(VRSI[k] > VRSI[i] & fUp[i] & fUp[k])
{
if(C[k] < C[i] & i-k > Lapse)
{
Div[i] = 1;
}
k = i-Length;
}
else
k = k-1;
} while( k > i-Length );
}

////////////////////////////

// Up

if(fDown[i])
{
k = i-1;
do
{
if(VRSI[k] < VRSI[i] & fDown[i] & fDown[k])
{
if(C[k] > C[i] & i-k > Lapse)
{
Div[i] = -1;
}
k = i-Length;
}
else
k = k-1;
} while( k > i-Length );
}

}



Fon = IIf(Div == 0, 0, 1);

Col = IIf(Div == 1, 4, IIf(Div == -1, 5, 1));

Color = IIf(Div == 1, 48, IIf(Div == -1, 14, 1));

Color = IIf(fUp == 1, 48, IIf(fDown == 1, 14, 1));

Div = IIf(Div == 0, Null, abs(Div));
Fon = abs(Div);




Title = EncodeColor(4)+"RSI(" + WriteVal(P, 2.0) + ")" + EncodeColor(1) + " ="+WriteVal(RSI(P)); 
Plot( RSI(P), "RSI", Col, 5);
Plot( 25,"", 4, 16+4096);
Plot( 75,"", 4, 16+4096);
Plot(Fon, "", Color, 16384+32768+4096, MinValue = 0, MaxValue = 1);

_SECTION_END();

2 comments

1. zagreus

Great !!

tx ;)

2. Mactoub

Is someone able to create code for Buy Sell commands?

Leave Comment

Please login here to leave a comment.

Back