public static void DrawTradeLines(this WealthScript ws) public static void DrawTradeLines(this WealthScript ws, bool showSignal)public static void DrawTradeLines() public static void DrawTradeLines(WealthScript ws, bool showSignal)
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators;namespace WealthLab.Strategies { public class TradeLinesDemo : WealthScript { protected override void Execute() { DataSeries maFast = SMA.Series(Close, 20); DataSeries maSlow = SMA.Series(Close, 60); PlotSeries(PricePane,maFast,Color.Red,LineStyle.Solid,2); PlotSeries(PricePane,maSlow,Color.Green,LineStyle.Solid,2); for(int bar = GetTradingLoopStartBar(maSlow.FirstValidValue); bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if (CrossUnder(bar, maFast, maSlow)) SellAtMarket(bar + 1, p); } else { if (CrossOver(bar, maFast, maSlow)) BuyAtMarket(bar + 1); } } this.DrawTradeLines(); } } }
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using Community.Components; // DrawTradeLines herenamespace WealthLab.Strategies { public class TradeLinesDemo : WealthScript { protected override void Execute() { DataSeries maFast = SMA.Series(Close, 20); DataSeries maSlow = SMA.Series(Close, 60); PlotSeries(PricePane,maFast,Color.Red,LineStyle.Solid,2); PlotSeries(PricePane,maSlow,Color.Green,LineStyle.Solid,2); for(int bar = GetTradingLoopStartBar(maSlow.FirstValidValue); bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if (CrossUnder(bar, maFast, maSlow)) SellAtMarket(bar + 1, p); } else { if (CrossOver(bar, maFast, maSlow)) BuyAtMarket(bar + 1); } } PositionHelper.DrawTradeLines( this ); // Pass a WealthScript instance as "this" } } }