I recently discovered that Amibroker RSI doesn't match with Standard RSI. I tried calculating RSI outside Amibroker using SMA, EMA and Wilder's smoothing and none of the values match with Amibroker RSI values.
Then I used the RSI equivalent function in RSI and looped through it and to my surprise Amibroker is not taking last 14 ticks for RSI (14). I dont know how long it's going and what inputs are taken. I have even printed the P and N values and if you try this outside Amibroker they don't match as C inside Amibroker is not last close but some other tick's close. This is the Amibroker code I have used.
// 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;
GfxTextOut("w" +W, 520,x);
GfxTextOut("S" +S, 320,x);
GfxTextOut("P" +p, 420,x);
GfxTextOut("n"+ n, 220,y);
GfxTextOut("c" +C[I], 620,x);
GfxTextOut("c" + C[I-1] , 720,x);
GfxTextOut("B" +BarCount +" " , 820,x);
if( i >= period )
result[ i ] = 100 * P / ( P + N );
Plot( BuiltInRSIEquivalent( 14 ), "RSI 1", colorRed );
C is not the same when I try it using .Net. Doest anyone have any idea? I want to Match RSI values of Amibroker from .Net on the same set of data using same time interval.
Please suggest if you know how to get this?