RSI
- relative strength index

Indicators


SYNTAX RSI( periods = 14 )
RSIa( array, periods = 14 )
RETURNS ARRAY
FUNCTION Calculates the RSI indicator using periods range
Second version RSIa accepts input array so it RSI can be applied to other arrays than close.
EXAMPLE RSI( 12 )
RSIa( High, 12 );
SEE ALSO  

Comments:

Tomasz Janeczko
tj -- at -- amibroker.com
2007-07-27 09:34:56
// Internally RSI is implemented as follows
//
function BuiltInRSIEquivalent( period )
{
P = N = 0;

result = Null;

for( i = 1; i < BarCount; i++ )
{
diff = C[ i ] - C[ i - 1 ];
W = S = 0;
if( diff > 0 ) W = diff;
if( diff < 0 ) S = -diff;

P = ( ( period -1 ) * P + W ) / period;
N = ( ( period -1 ) * N + S ) / period;

if( i >= period )
result[ i ] = 100 * P / ( P + N );
}
return result;
}

Plot( BuiltInRSIEquivalent( 14 ), "RSI 1", colorRed );
Plot( RSI( 14 ), "RSI 2", colorBlue );

References:

The RSI function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.