using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using TASCIndicators; using Community.Indicators;namespace WealthLab.Strategies { public class SC202010 : WealthScript { protected override void Execute() { var hilo = GannHiLoActivator.Series(Bars, 3, false); var dmi = DIPlus.Series(Bars, 10) - DIMinus.Series(Bars, 10); var smi = SMI.Series(Bars, 8, 3, 3); PlotSeries( PricePane, hilo, Color.DarkGreen, LineStyle.Solid, 2); PlotSeries( CreatePane( 30,false,true), dmi, Color.DarkGreen, LineStyle.Histogram, 3); ChartPane sPane = CreatePane( 30,false,true); PlotSeries( sPane, smi, Color.Fuchsia, LineStyle.Solid, 2); DrawHorzLine( sPane, 40, Color.Green, LineStyle.Dashed, 1); DrawHorzLine( sPane, -40, Color.Red, LineStyle.Dashed, 1); HideVolume(); for(int bar = GetTradingLoopStartBar( 20 ); bar < Bars.Count; bar++) { var _long = (Closebar > hilobar && dmibar > 0 && smibar > 0); var _short = (Closebar < hilobar && dmibar < 0 && smibar < 0); if (Closebar > hilobar) SetSeriesBarColor( bar, hilo, Color.DarkGreen); else SetSeriesBarColor( bar, hilo, Color.Red); if (dmibar > 0) SetSeriesBarColor( bar, dmi, Color.DarkGreen); else SetSeriesBarColor( bar, dmi, Color.Red); if (smibar > 0) SetSeriesBarColor( bar, smi, Color.DarkGreen); else SetSeriesBarColor( bar, smi, Color.Red); if (_long) SetBackgroundColor( bar, Color.FromArgb(30, Color.DarkGreen)); if(_short) SetBackgroundColor( bar, Color.FromArgb(30, Color.DarkRed)); if (IsLastPositionActive) { if ( _short ) SellAtMarket( bar + 1, LastPosition); } else { if ( _long ) BuyAtMarket( bar + 1); } } } } }