using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using TASCIndicators;namespace WealthLab.Strategies { public class TASCTips201507 : WealthScript { private StrategyParameter paramSVSIPeriod; private StrategyParameter paramSVSIWMAPeriod; private StrategyParameter paramSVSIThreshold; private StrategyParameter paramSMAPeriod; private StrategyParameter paramExitChannel; public TASCTips201507() { paramSVSIPeriod = CreateParameter("SVSI Period",6,6,30,2); paramSVSIWMAPeriod = CreateParameter("SVSI WilderMA Period",14,8,52,4); paramSVSIThreshold = CreateParameter("SVSI Threshold",50,40,90,5); paramSMAPeriod = CreateParameter("SMA Period",40,10,100,10); paramExitChannel = CreateParameter("Trailing Exit",20,5,50,5); } protected override void Execute() { int svsiThreshold = paramSVSIThreshold.ValueInt; int smaPeriod = paramSMAPeriod.ValueInt; int trailingExit = paramExitChannel.ValueInt; SVSI svsi = SVSI.Series(Bars,paramSVSIPeriod.ValueInt, paramSVSIWMAPeriod.ValueInt); SMA sma = SMA.Series(Close,smaPeriod); ChartPane paneSVSI1 = CreatePane(40,true,true); PlotSeries(PricePane,sma,Color.MediumVioletRed,LineStyle.Solid,1); PlotSeries(paneSVSI1,svsi,Color.FromArgb(255,255,128,0),LineStyle.Solid,2); DrawHorzLine(paneSVSI1,50,Color.DodgerBlue,LineStyle.Dashed,2); for(int bar = GetTradingLoopStartBar(1); bar < Bars.Count; bar++) { if (IsLastPositionActive) { SellAtTrailingStop(bar+1,LastPosition, Lowest.Series(Low,trailingExit)bar); } else { if( Closebar > smabar && svsibar < svsiThreshold ) BuyAtMarket(bar+1); } } } } }