Function File: movavg (asset, lead, lag)
Function File: movavg (asset, lead, lag, alpha)
Function File: [short, long] = movavg (asset, lead, lag, alpha)

Calculate the leading and lagging moving average of an asset. If given, alpha is the weighting power of the delay; 0 (default) is the simple moving average, 0.5 would be the square root weighted moving average, 1 would be linear, 2 would be squared, ..., and ’e’ is the exponential moving average.

If no output is requested the data is plotted. The plots are drawn in the following order: asset, lag, lead. If output is requested, no plot is generated.

See also: bolling, candle, dateaxis, highlow, pointfig.

Package: financial