using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators;namespace WealthLab.Strategies { public class TradersTipsOct2019 : WealthScript { private StrategyParameter paramPeriod; private StrategyParameter paramDev; public TradersTipsOct2019() { paramPeriod = CreateParameter("Bands Period", 20, 5, 50, 5); paramDev = CreateParameter("Bands Dev.", 2.0, 0.5, 5.0, 0.5); } protected override void Execute() { int period = paramPeriod.ValueInt; var bbU = BBandUpper.Series(High,period, paramDev.Value); var bbL = BBandLower.Series(Low, period, paramDev.Value); PlotSeriesFillBand(PricePane, bbU, bbL, Color.Silver, Color.FromArgb(10,Color.Green), LineStyle.Solid, 1); for(int bar = GetTradingLoopStartBar(period); bar < Bars.Count; bar++) { if (IsLastPositionActive) { if(Highbar > bbUbar) ExitAtMarket(bar+1,LastPosition); } else { //touches the lower band if( (Closebar-1 > bbLbar-1) && ((Lowbar-1 < bbLbar-1) || (Lowbar-2 < bbLbar-2)) //engulfing: && (Closebar-2 < Openbar-2) && (Closebar-1 > Openbar-1) && (Openbar-1 < Closebar-2) && (Closebar-1 > Openbar-2) && ((Closebar-1 - Openbar-1) > 20*Bars.SymbolInfo.Tick) && (Closebar > Highbar-1 ) ) BuyAtMarket(bar+1); } } } } }