Financial Toolbox
  Go to function:
    Search    Help Desk 
movavg    Examples   See Also

Leading and lagging moving averages chart.

Syntax

Arguments

asset
Security data, usually a vector of time-series prices.
lead
Number of samples to use in leading average calculation. A positive integer. lead must be less than or equal to lag.
lag
Number of samples to use in the lagging average calculation. A positive integer.
alpha
Control parameter that determines the type of moving averages.
0 = simple moving average (default), 0.5 = square root weighted moving average, 1 = linear moving average, 2 = square weighted moving average, etc. To calculate the exponential moving average, set
alpha ='e'.

Description

movavg(asset, lead, lag, alpha) plots leading and lagging moving averages.

[short, long] = movavg(asset, lead, lag, alpha) returns the leading short and lagging long moving average data without plotting it.

Example

If asset is a vector of stock price data:

plots linear three-sample leading and 20-sample lagging moving averages.

See Also

bolling, candle, dateaxis, highlow, pointfig

[ Previous | Help Desk | Next ]