public static SMA Series(WealthLab.DataSeries ds, int period) public SMA(DataSeries ds, int period, string description) public static double Value(int bar, DataSeries ds, 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() { // An SMA Crossover system int FastPer = 40; int SlowPer = 100; DataSeries hFast = SMA.Series( Close, FastPer ); DataSeries hSlow = SMA.Series( Close, SlowPer ); PlotSeries( PricePane, hFast, Color.Red, WealthLab.LineStyle.Solid, 1 ); PlotSeries( PricePane, hSlow, Color.Blue, WealthLab.LineStyle.Solid, 1 ); for(int bar = SlowPer; bar < Bars.Count; bar++) { if (IsLastPositionActive) { if( CrossUnder( bar, hFast, hSlow ) ) SellAtMarket( bar+1, LastPosition ); } else { if( CrossOver( bar, hFast, hSlow ) ) BuyAtMarket( bar+1 ); } } } } }