IIndicatorsAccessor.WeightedMovingAverage
method · IIndicatorsAccessor · cAlgo.API.Internals
DesktopCLICloud
The Weighted Moving Average smoothes the price data producing a trend indicator.
Definition
WeightedMovingAverage WeightedMovingAverage(DataSeries source, int periods)
api.Indicators.WeightedMovingAverage(source: DataSeries, periods: int) -> WeightedMovingAverage
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
source | DataSeries | DataSeries | The source data used for WMA calculation. |
periods | int | int | The periods used in the calculation. |
Returns WeightedMovingAverage — Weighted Moving Average indicator instance
Examples
var wma = Indicators.WeightedMovingAverage(Bars.ClosePrices, 20);
Print("WMA(20) last value: {0}", wma.Result.LastValue);
wma = api.Indicators.WeightedMovingAverage(api.Bars.ClosePrices, 20)
api.Print(f"WMA(20) last value: {wma.Result.LastValue}")