public DEMA(DataSeries ds, int period1, int period2, string description) public static DEMA(DataSeries ds, int period1, int period2)
DEMA = 2*EMA - EMA(EMA)
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 ); } } } } }