Skip to content

MovingAverageType

enum cAlgo.API

DesktopCLICloud

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

Definition

public enum MovingAverageType

Namespace: cAlgo.API · Group: Indicators

Examples

using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo
{
    // A sample indicator that shows how to use different types of moving average
    public partial class MovingAverageTypeSample : Indicator
    {
        private MovingAverage _ma;

        protected override void Initialize()
        {
            _ma = Indicators.MovingAverage(Bars.ClosePrices, 14, MovingAverageType);
        }

        public override void Calculate(int index)
        {
            Result[index] = _ma.Result[index];
        }
    }
}
class MovingAverageTypeSample():
    def initialize(self):
        self.ma = api.Indicators.MovingAverage(api.Bars.ClosePrices, 14, api.MovingAverageType)

    def calculate(self, index):
        api.Result[index] = self.ma.Result[index]
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true,
  "Parameters": [
    {
      "Name": "MovingAverageType",
      "DisplayName": "Type",
      "Type": "Enum",
      "EnumTypeFullName": "cAlgo.API.MovingAverageType",
      "DefaultValue": "Simple"
    }
  ],
  "LineOutputs": [
    {
      "Name": "Result",
      "DisplayName": "Main"
    }
  ]
}

Values

Name Value Description
Simple 0 Use uniform weighting. Represents indicator of SimpleMovingAverage type.
Exponential 1 Use exponential weighting. Represents indicator of ExponentialMovingAverage type.
TimeSeries 2 Represents indicator of TimeSeriesMovingAverage type.
Triangular 3 Represents indicator of TriangularMovingAverage type.
VIDYA 4 VIDYA (Variable Index Dynamic Average) variable length weighting. Represents indicator of VariableIndexDynamicAverage type.
Weighted 5 Represents indicator of WeightedMovingAverage type.
WilderSmoothing 6 Represents indicator of WellesWilderSmoothing type.
Hull 7 Represents indicator of HullMovingAverage type.
DoubleExponential 8 Represents indicator of DoubleExponentialMovingAverage type.
TripleExponential 9 Represents indicator of TripleExponentialMovingAverage type.
KaufmanAdaptive 10 Represents indicator of KaufmanAdaptiveMovingAverage type.