using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using TASCIndicators;namespace WealthLab.Strategies { public class MyStrategy : WealthScript { private StrategyParameter paramPeriodVWMA; private StrategyParameter paramPeriodSMA; public MyStrategy() { paramPeriodVWMA = CreateParameter("VWMA Period",50,2,300,1); paramPeriodSMA = CreateParameter("SMA Period",70,2,300,1); } protected override void Execute() { var sma = SMA.Series(Close,paramPeriodSMA.ValueInt); var vwma = VWMA.Series(Bars,paramPeriodVWMA.ValueInt); for(int bar = GetTradingLoopStartBar(1); bar < Bars.Count; bar++) { if (IsLastPositionActive) { if( CrossUnder(bar,vwma,sma)) SellAtMarket(bar+1, LastPosition); } else { if( CrossOver(bar,vwma,sma)) BuyAtMarket(bar+1); } } PlotSeries(PricePane,vwma,Color.Red,LineStyle.Solid,1); PlotSeries(PricePane,sma,Color.Blue,LineStyle.Solid,1); } } }