// Downloaded From https://www.WiseStockTrader.com
//RSI
// this is different from amibroker inbuilt RSI and similar to the chartink or chartnexus.
//created on 18/12/2015 by MKP Manikandan

Period = Param("Period", 14, 2, 100 );
Diff = C - Ref( C, -1 );
Up = Max( Diff, 0 );
Dn = Max( -Diff, 0 );
UpSum = Sum( Up, Period );
DnSum = Sum( Dn, Period );
RS = IIf( DnSum != 0, UpSum / DnSum, 100 );
CRSI = 100 - 100 / ( 1 + RS );
Plot( CRSI, "CRSI"+Period, colorBlue );
Plot(70,"Overbought",colorRed,styleLine);
Plot(30,"Oversold",colorGreen,styleLine);
_SECTION_END();