Author Topic: RSI data points are different in Amibroker?  (Read 176 times)

pawarganesh

  • Newbie
  • *
  • Posts: 1
    • View Profile
RSI data points are different in Amibroker?
« on: November 06, 2016, 12:54:21 pm »
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.
Code: [Select]
_SECTION_BEGIN("TD 11");
// Internally RSI is implemented as follows
//
function BuiltInRSIEquivalent( period )
{
P = N = 0;

result = Null;
x=20;
y=20;
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;

x=x+20;
y=y+20;
if (i<=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 );
}

return result;
}

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

_SECTION_END();



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?

Thanks,
Ganesh
« Last Edit: December 06, 2016, 07:02:14 am by administrator »