Skip to content

DoubleExponentialMovingAverage

interface cAlgo.API.Indicators

DesktopCLICloud

The Double Exponential Moving Average (DEMA) is a combination of smoothed exponential moving averages (EMA) and a basic EMA

Definition

public interface DoubleExponentialMovingAverage

Namespace: cAlgo.API.Indicators · Group: Indicators · Implements: MovingAverage, StandardIndicator

Examples

private DoubleExponentialMovingAverage _dema;

protected override void OnStart()
{
    _dema = Indicators.DoubleExponentialMovingAverage(Bars.ClosePrices, 21);
}

protected override void OnBar()
{
    if (Bars.ClosePrices.Last(1) > _dema.Result.Last(1))
        Print("Close is above DEMA: {0}", _dema.Result.Last(1));
}
def on_start(self):
    self.dema = api.Indicators.DoubleExponentialMovingAverage(api.Bars.ClosePrices, 21)

def on_bar(self):
    if api.Bars.ClosePrices.Last(1) > self.dema.Result.Last(1):
        api.Print(f"Close is above DEMA: {self.dema.Result.Last(1)}")

Inherited members

From MovingAverage: Result

From StandardIndicator: AddToChart, Symbol, TimeFrame, Bars