public EMPlus(DataSeries source, int period, string description) public static EMPlus Series(DataSeries source, int period) public static double Value(int bar, DataSeries source, int period)
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() { ChartPane EMPane = CreatePane( 35, true, true ); DataSeries EMPlus1 = EMPlus.Series( Close, 40 ); PlotSeries( EMPane, EMPlus1, Color.Blue, LineStyle.Solid, 1 ); PlotStops(); for(int bar = 40; bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if( p.MAEAsOfBarPercent(bar) < -6 ) SellAtMarket( bar+1, p, "Stop Loss 6%" ); else SellAtAutoTrailingStop( bar+1, p, 2, 25, "Trailing Stop 2,25" ); } else { // Looks like a bull trend has formed if( CrossOver( bar, EMPlus1, 20 ) ) BuyAtMarket( bar+1, "Bull" ); } } } } }