Financial Toolbox |
 |
movavg
Leading and lagging moving averages chart
Syntax
movavg(Asset, Lead, Lag, Alpha)
[Short, Long] = movavg(Asset, Lead, Lag, Alpha)
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
|
(Optional) 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.
Examples
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
| months | | nomrr |  |