public EMA(DataSeries source, int period, EMACalculation calcType, string description) public static EMA Series(DataSeries source, int period, EMACalculation calcType)
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators;namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { // Dual EMA CrossOver System } DataSeries ema60 = EMA.Series( Close, 60, WealthLab.Indicators.EMACalculation.Modern ); DataSeries ema120 = EMA.Series( Close, 120, EMACalculation.Modern ); PlotSeries( PricePane, ema60, Color.Black, WealthLab.LineStyle.Solid, 3 ); PlotSeries( PricePane, ema120, Color.DarkGray, LineStyle.Solid, 1 ); // EMA is one of unstable indicators, initialize the loop accordingly for(int bar = 120*3; bar < Bars.Count; bar++) { if (!IsLastPositionActive) { if( CrossOver( bar, ema60, ema120 ) ) BuyAtMarket( bar+1 ); } else { if( CrossUnder( bar, ema60, ema120 ) ) SellAtMarket( bar+1, LastPosition ); } } } } }