public static void PlotSymbolTrades(this WealthScript obj, Bars symbol, ChartPane pane)public void PlotSymbolTrades(Bars symbol, ChartPane pane)
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators;namespace WealthLab.Strategies { public class PlotSymbolTradesDemo : WealthScript { protected override void Execute() { for(int bar = 40; bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; SetContext( "KO", true ); if( p.PositionType == PositionType.Long ) SellAtStop( bar+1, p, Lowest.Series( Low,20 )bar ); else CoverAtStop( bar+1, p, Highest.Series( High,20 )bar ); RestoreContext(); } else { SetContext( "KO", true ); Position p = BuyAtStop( bar+1, Highest.Series( High,40 )bar ); if( p == null ) ShortAtStop( bar+1, Lowest.Series( Low,40 )bar ); RestoreContext(); } } const string SymbolPair = "KO"; if( Bars.Symbol != SymbolPair ) { ChartPane pane = CreatePane( 100, false, true ); this.PlotSymbolTrades( GetExternalSymbol( SymbolPair, true ), pane ); HideVolume(); } } } }
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using Community.Components; /*** Requires installation of Community.Components Extension from www.wealth-lab.com > Extensions ***/namespace WealthLab.Strategies { public class PlotSymbolTradesDemo : WealthScript { protected override void Execute() { Utility u = new Utility( this ); for(int bar = 40; bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; SetContext( "KO", true ); if( p.PositionType == PositionType.Long ) SellAtStop( bar+1, p, Lowest.Series( Low,20 )bar ); else CoverAtStop( bar+1, p, Highest.Series( High,20 )bar ); RestoreContext(); } else { SetContext( "KO", true ); Position p = BuyAtStop( bar+1, Highest.Series( High,40 )bar ); if( p == null ) ShortAtStop( bar+1, Lowest.Series( Low,40 )bar ); RestoreContext(); } } const string SymbolPair = "KO"; if( Bars.Symbol != SymbolPair ) { ChartPane pane = CreatePane( 100, false, true ); u.PlotSymbolTrades( GetExternalSymbol( SymbolPair, true ), pane ); HideVolume(); } } } }