DEMA

Modified on 2019/02/28 06:01 by Eugene — Categorized as: Community Indicators

Syntax

public DEMA(DataSeries ds, int period1, int period2, string description)
public static DEMA(DataSeries ds, int period1, int period2)

Parameter Description

dsDataSeries
period1Length used to create the EMA
period2Length used to double smooth the EMA

Description

The Double Exponential Moving Average (DEMA) by Patrick G. Mulloy was introduced in his January 1994 article in the "Technical Analysis of Stocks & Commodities" and attempts to remove the moving average lag by emphasizing its more recent values. Accordning to Mulloy, "the DEMA is not just a double EMA with twice the lag time of a single EMA, but is a composite implementation of single and double EMAs producing another EMA with less lag than either of the original two."

Calculation

DEMA = 2*EMA - EMA(EMA)

Interpretation

Similar to EMA.

Example

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Indicators;

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { // Dual DEMA CrossOver System var dema1 = DEMA.Series( Close, 12, 26 ); var dema2 = DEMA.Series( Close, 21, 55 ); PlotSeries( PricePane, dema1, Color.Red, LineStyle.Solid, 2 ); PlotSeries( PricePane, dema2, Color.Blue, LineStyle.Solid, 2 ); // DEMA is one of unstable indicators, initialize the loop accordingly for(int bar = 55*3; bar < Bars.Count; bar++) { if (IsLastPositionActive) { if( CrossUnder( bar, dema1, dema2 ) ) SellAtMarket( bar+1, LastPosition ); } else { if( CrossOver( bar, dema1, dema2 ) ) BuyAtMarket( bar+1 ); } } } } }