SymbolInfo Object

The SymbolInfo object represents a number of symbol's properties: Decimals, Margin, Point Value, Security Type and Tick.

Remarks

BuyAtMarket

Decimals Property

int Decimals

Specifies the number of decimals that should be used when displaying the price values in the Bars object.


Example

protected override void Execute(){
    // Number of decimals
    SymbolInfo si = Bars.SymbolInfo;
    PrintDebug( "Decimals = " + si.Decimals); 
}
BuyAtMarket

Margin Property

double Margin

Returns the margin value if the Bars object contains data for a futures contract.  The margin value is the amount deducted in backtesting for buying or shorting a single contract.


Example

protected override void Execute(){
    // Commodity Selection Index by Welles Wilder Jr. (c) 1979
    int Commission = 8;
    int adxPeriod = 14;
    DataSeries CSI = new DataSeries( Bars, "Commodity Selection Index (CSI)" );
    SymbolInfo si = Bars.SymbolInfo;
    
    if( si.Margin > 0 )
    {
        for(int bar = adxPeriod; bar < Bars.Count; bar++)
        {
            CSI[bar] = ADXR.Series( Bars, adxPeriod )[bar] * ATR.Series( Bars, adxPeriod )[bar] * ( ( si.PointValue / Math.Sqrt( si.Margin ) ) * (float) 1 / ( 150 + Commission )  ) * 100;
        }
    } else
        // Will not execute if margin is not specified in Symbol Info Manager
    Abort();
    
    // Plot Commodity Selection Index on chart
    ChartPane CSIPane = CreatePane( 75, true, true );
    PlotSeries( CSIPane, CSI, Color.Blue, WealthLab.LineStyle.Solid, 2 );                

}
BuyAtMarket

PointValue Property

double PointValue

Returns the point value if the Bars object contains data for a futures contract.  The point value represents how much profit is gained when a single contract moves up one full point.

Remarks


Example

protected override void Execute(){
    // "The Price Movement Index", as found in the book by Nauzer Balsara, 
    // "Money Management Strategies for Futures Traders"

    int Sessions = 10; // no. of trading sessions to measure dollar value of price move
    double DollarValueInTick, TicksInPriceMove, DollarValue, PriceMovementIndex;
    DataSeries PMI = new DataSeries( Bars, "Price Movement Index (PMI)" );

    SymbolInfo si = Bars.SymbolInfo;
    DollarValueInTick = si.Tick * si.PointValue;
    
    if( si.Margin > 0 )
    {
        for(int bar = Sessions; bar < Bars.Count; bar++)
        {
            TicksInPriceMove = ( Highest.Value( bar, High, Sessions ) - Lowest.Value( bar, Low, Sessions ) ) / si.Tick;
            DollarValue = DollarValueInTick * TicksInPriceMove;
            PMI[bar] = DollarValue / si.Margin * 100;
        }
    } else
        // Will not execute if margin was not found in Symbol Info Manager
        Abort();
    
    // Plot Price Movement Index on chart
    ChartPane PMIPane = CreatePane( 75, true, true );
    PlotSeries( PMIPane, PMI, Color.Blue, WealthLab.LineStyle.Solid, 2 );                

}
BuyAtMarket

SecurityType Property

SecurityType SecurityType

Returns the type of data contained in the Bars object.  Possible values are:

  • Equity
  • Future
  • MutualFund

Example

protected override void Execute(){
    SymbolInfo si = Bars.SymbolInfo;
    // Sense equity/future to switch trading logic 
    if ( si.SecurityType == WealthLab.SecurityType.Future )
    {
        // Commodities trading logic
    }
    else
    {
        // Stocks trading logic
    }
}
BuyAtMarket

Tick Property

double Tick

Returns the tick value if the Bars object contains data for a futures contract.  The tick value represents the granularity of the futures contract.  Wealth-Lab will adjust limit and stop order prices so that they conform to the tick level of the contract.  For example, if the contract tick value is 0.25, a BuyAtLimit or ShortAtStop order generated at 12.34 will be rounded to 12.25.

Remarks

  • The default tick value for stocks is 0.01, but can be adjusted in the Symbol Info Manager.
  • See the "Futures Mode" topic in the Reference chapter of the User Guide for more information.

Example

protected override void Execute(){
    double stop;

    // Calculate stop value using the Symbol Info Manager data (must be entered)
    switch (Bars.SymbolInfo.Symbol) 
    {
        case "CL_RAD":
            stop = 1000 * Bars.SymbolInfo.Tick;
            break;
        case "NG_RAD":
            stop = 500 * Bars.SymbolInfo.Tick;
            break;
        default:
            stop = 700 * Bars.SymbolInfo.Tick;
            break;
    }
    
    PrintDebug( "Stop value is " + stop + " ticks" );
}