John F. Ehlers proposes to a new solution to “Remove a Moving Average Lag” in the March 2025 issue of Trader’s Tips.
He explains that the average price in a time series average represents a statistical estimate for a block of price values, where the estimate is positioned at the block’s centre on the time axis. In the case of a simple moving average (SMA), the calculation moves the analysed block along the time axis and computes an average after each new price point. Because the average’s position is at the centre of each block, the SMA, by definition, lags behind price changes by half the data length.
To remove/mitigate this lag, Ehlers proposes a new projected moving average (PMA). He does this by adding half the data length of a block to the simple moving average using the data’s linear regression slope.
This is easy to implement in ProRealtime:
//
length = 10
//
slope = LinearRegressionSlope[ length ]( close )
projection = slope * length / 2
sma = average[ length ]( close )
pma = sma + projection
return pma, sma