ScrewTurn

Active Trader Strategies API Community ChartStyles Community Commissions Community Components Community Indicators Knowledge Base Misc Optimizers PosSizers Providers Standard Indicators TASC Traders Tips TASCIndicators Tutorial Videos Visualizers
RSS

Navigation







Quick Search
»
Advanced Search »

PoweredBy

Syntax


public void PlotSymbolTrades(Bars symbol, ChartPane pane)

Parameter Description

symbol The Bars object of an external symbol
pane ChartPane to plot the trades on

Description

Visualizes trades made on external symbols. Helpful for pair trading strategies and in general, for any strategy that makes trades on an external symbol.

Example

Image

Here is an example illustrating how to use the method in your Strategy code. Make sure you have "KO" in one of your DataSets and run the example on another symbol:


using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Components;

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(); } } } }

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes.

Used under license from FMR Corp. Copyright 2008 FMR Corp. All rights reserved.


ScrewTurn Wiki version 3.0.2.509. Some of the icons created by FamFamFam.