wikipedia.org describes the implementation of the moving averages for the RSI as follows:
if ((CurrentBar + 1) == Period)
{
// First averages
avgDown.Set(SMA(down, Period)[0]);
avgUp.Set(SMA(up, Period)[0]);
}
else
{
// Rest of averages are smoothed
[B][COLOR=Red] avgDown.Set((avgDown[1] * (Period - 1) + down[0]) / Period);
avgUp.Set((avgUp[1] * (Period - 1) + up[0]) / Period);[/COLOR][/B]
}
Ralph

Comment