Skip to content

MovingAverageType

Summary

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

Signature

1
public enum MovingAverageType

Namespace

cAlgo.API

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];
         }
     }
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
 import clr
 clr.AddReference("cAlgo.API")
 from cAlgo.API import *
 class Test():    
     def initialize(self):
         # MovingAverageType is a parameter of type MovingAverageType Enum defined in indicator C# file
         self.ma = api.Indicators.MovingAverage(api.Bars.ClosePrices, 14, api.MovingAverageType)
     def calculate(self, index):
         # Result is an output defined in indicator C# file
         api.Result[index] = self.ma.Result[index]

Fields

Simple

Summary

Use uniform weighting. Represents indicator oftype.

Signature

1
MovingAverageType.Simple;

Return Value

MovingAverageType

Examples

1
2
 [Parameter("MAType", DefaultValue = MovingAverageType.Simple)]
 public MovingAverageType MaType { get; set; }

Exponential

Summary

Use exponential weighting. Represents indicator oftype.

Signature

1
MovingAverageType.Exponential;

Return Value

MovingAverageType

Examples

1
2
 [Parameter("MAType", DefaultValue = MovingAverageType.Exponential)]
 public MovingAverageType MaType { get; set; }

TimeSeries

Summary

Represents indicator oftype.

Signature

1
MovingAverageType.TimeSeries;

Return Value

MovingAverageType

Examples

1
2
 [Parameter("MAType", DefaultValue = MovingAverageType.TimeSeries)]
 public MovingAverageType MaType { get; set; }

Triangular

Summary

Represents indicator oftype.

Signature

1
MovingAverageType.Triangular;

Return Value

MovingAverageType

Examples

1
2
 [Parameter("MAType", DefaultValue = MovingAverageType.Triangular)]
 public MovingAverageType MaType { get; set; }

VIDYA

Summary

VIDYA (Variable Index Dynamic Average) variable length weighting. Represents indicator oftype.

Signature

1
MovingAverageType.VIDYA;

Return Value

MovingAverageType

Examples

1
2
 [Parameter("MAType", DefaultValue = MovingAverageType.VIDYA)]
 public MovingAverageType MaType { get; set; }

Weighted

Summary

Represents indicator oftype.

Signature

1
MovingAverageType.Weighted;

Return Value

MovingAverageType

Examples

1
2
 [Parameter("MAType", DefaultValue = MovingAverageType.Weighted)]
 public MovingAverageType MaType { get; set; }

WilderSmoothing

Summary

Represents indicator oftype.

Signature

1
MovingAverageType.WilderSmoothing;

Return Value

MovingAverageType

Examples

1
2
 [Parameter("MAType", DefaultValue = MovingAverageType.WilderSmoothing)]
 public MovingAverageType MaType { get; set; }
1
 private MovingAverageType _wilderSmoothing = MovingAverageType.WilderSmoothing;

Hull

Summary

Represents indicator oftype.

Signature

1
MovingAverageType.Hull;

Return Value

MovingAverageType

Examples

1
2
 [Parameter("MAType", DefaultValue = MovingAverageType.Hull)]
 public MovingAverageType MaType { get; set; }
1
 private MovingAverageType _hull = MovingAverageType.Hull;

DoubleExponential

Summary

Represents indicator oftype.

Signature

1
MovingAverageType.DoubleExponential;

Return Value

MovingAverageType

Examples

1
2
 [Parameter("MAType", DefaultValue = MovingAverageType.DoubleExponential)]
 public MovingAverageType MaType { get; set; }
1
 private MovingAverageType _dema = MovingAverageType.DoubleExponential;

TripleExponential

Summary

Represents indicator oftype.

Signature

1
MovingAverageType.TripleExponential;

Return Value

MovingAverageType

Examples

1
2
 [Parameter("MAType", DefaultValue = MovingAverageType.TripleExponential)]
 public MovingAverageType MaType { get; set; }
1
 private MovingAverageType _tema = MovingAverageType.TripleExponential;

KaufmanAdaptive

Summary

Represents indicator oftype.

Signature

1
MovingAverageType.KaufmanAdaptive;

Return Value

MovingAverageType

Examples

1
2
 [Parameter("MAType", DefaultValue = MovingAverageType.KaufmanAdaptive)]
 public MovingAverageType MaType { get; set; }
1
 private MovingAverageType _kama = MovingAverageType.KaufmanAdaptive;