public static StochD Series(Bars bars, int period, int smooth) public StochD(Bars bars, int period, int smooth, string description)
//DataSeries stochd = StochD.Series(Bars,period,smooth);DataSeries stochd = SMA.Series( StochK.Series(Bars,period), smooth);
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() { // Simple system based on Slow Stochastic ChartPane StochPane = CreatePane( 30, true, true ); DataSeries SlowK = StochD.Series( Bars, 10, 3 ); DataSeries SlowD = SMA.Series( SlowK, 3 ); PlotSeries( StochPane, SlowK, Color.Purple, WealthLab.LineStyle.Solid, 2 ); PlotSeries( StochPane, SlowD, Color.Black, WealthLab.LineStyle.Solid, 2 ); for(int bar = 20; bar < Bars.Count; bar++) { if (!IsLastPositionActive) { if( CrossOver( bar, SlowK, SlowD ) & ( SlowKbar-1 < 20 ) ) BuyAtMarket( bar+1); } else { if( CrossOver( bar, SlowK, 80 ) ) SellAtMarket( bar+1, LastPosition ); } } } } }