Skip to content

MovingAverageType

Summary

An enumeration of the different MovingAverage weighting (smoothing) methods.

Signature

1
public enum MovingAverageType

Namespace

cAlgo.API

Fields

Name Description
Simple Use uniform weighting. Represents indicator oftype.
Exponential Use exponential weighting. Represents indicator oftype.
TimeSeries Represents indicator oftype.
Triangular Represents indicator oftype.
VIDYA VIDYA (Volatility Index Dynamic Average) variable length weighting. Represents indicator oftype.
Weighted Represents indicator oftype.
WilderSmoothing Represents indicator oftype.
Hull Represents indicator oftype.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 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];
         }
     }
 }

Last update: July 1, 2022

Comments