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(High[bar] > bbU[bar]) ExitAtMarket(bar+1,LastPosition); } else { //touches the lower band if( (Close[bar-1] > bbL[bar-1]) && ((Low[bar-1] < bbL[bar-1]) || (Low[bar-2] < bbL[bar-2])) //engulfing: && (Close[bar-2] < Open[bar-2]) && (Close[bar-1] > Open[bar-1]) && (Open[bar-1] < Close[bar-2]) && (Close[bar-1] > Open[bar-2]) && ((Close[bar-1] - Open[bar-1]) > 20*Bars.SymbolInfo.Tick) && (Close[bar] > High[bar-1] ) ) BuyAtMarket(bar+1); } } } } }