wikipedia.org describes the implementation of the moving averages for the RSI as follows:

*U*and

*D*are calculated using an

*n*-period exponential moving average (EMA) in the AIQ version (but with an equal-weighted moving average in Wilder's original version).

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