Summary
An enumeration of the different MovingAverage weighting (smoothing) methods.
Syntax
public sealed enum MovingAverageType
Members
Name | Type | Summary |
---|---|---|
Exponential | Field | Use exponential weighting. Represents indicator of ExponentialMovingAverage type. |
Hull | Field | Represents indicator of HullMovingAverage type. |
Simple | Field | Use uniform weighting. Represents indicator of SimpleMovingAverage type. |
TimeSeries | Field | Represents indicator of TimeSeriesMovingAverage type. |
Triangular | Field | Represents indicator of TriangularMovingAverage type. |
VIDYA | Field | VIDYA (Volatility Index Dynamic Average) variable length weighting. Represents indicator of Vidya type. |
Weighted | Field | Represents indicator of WeightedMovingAverage type. |
WilderSmoothing | Field | Represents indicator of WellesWilderSmoothing type. |
Example 1
using cAlgo.API; using cAlgo.API.Indicators; namespace cAlgo { // A sample indicator that shows how to use different types of moving average [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class MovingAverageTypeSample : Indicator { private MovingAverage _ma; [Parameter("Type", DefaultValue = MovingAverageType.Simple)] public MovingAverageType MovingAverageType { get; set; } [Output("Main")] public IndicatorDataSeries Result { get; set; } protected override void Initialize() { _ma = Indicators.MovingAverage(Bars.ClosePrices, 14, MovingAverageType); } public override void Calculate(int index) { Result[index] = _ma.Result[index]; } } }