Search Framework:
Enums
Namespace: WealthLab.Core
Parent:

This page documents enumerated types used throughout the WealthLab .NET Framework.

Enumerated Types
Frequency
public enum Frequency

Represents the frequency of historical data. Possible values are:

  • Daily
  • Weekly
  • Monthly
  • Quarterly
  • Yearly
  • Tick
  • Second
  • Minute
  • Volume
  • Hour
  • NDays
  • WeeklyStartDay
  • SemiAnnually
  • BiWeekly

LineStyle
public enum LineStyle

Specifies how lines are rendered by WealthLab charting and drawing methods. Possible values are:

  • Solid
  • Dashed
  • Dotted

OptimizationRunType
public enum OptimizationRunType

Specifies the type of optimization run. Possible values are:

  • None
  • Standard
  • WFO
  • SymbolBySymbol

OptionSymbolFormat
public enum OptionSymbolFormat

Identifies supported option symbol formats. Possible values are:

  • Compact
  • OCC
  • LegacyMonthCode
  • TDAmeritrade
  • LegacyPadded

Remarks

  • Compact - Compact option symbol format. Example: TTD230712C75. Used by providers such as Interactive Brokers.
  • OCC - Standard OCC/OSI format using a padded strike price. Example: TTD230721C00075000. Used by providers such as Tradier and TradeStation.
  • LegacyMonthCode - Legacy format using a month letter code, day, and year. Example: TTD2321G75, where G represents July. Used by platforms such as TradingView, IQFeed, and Collective2.
  • TDAmeritrade - Obsolete TD Ameritrade format using an mmyydd date. Example: TTD_072123C75.
  • LegacyPadded - Legacy OCC format using a six-character space-padded underlying symbol. Example: TTD 230721C00075000. Used by Schwab.

OrderType
public enum OrderType

Specifies the type of order submitted to the Backtester or a Broker. Possible values are:

  • Market
  • Limit
  • Stop
  • FixedPrice
  • LimitMove
  • MarketClose
  • LimitClose
  • StopLimit

Remarks

  • Limit - Executes the simulated order if the bar's price reaches or penetrates the limit price in the favorable direction. If the bar opens beyond the limit price, the simulated order fills at the opening price.
  • Stop - Executes the simulated order if the bar's price reaches or penetrates the stop price. If the bar opens beyond the stop price, the simulated order fills at the opening price.
  • StopLimit - Works like a Stop order but adds a Limit price constraint. Assign the limit price to the Transaction's StopLimitLimitPrice property. Brokers can impose restrictions on the relationship between the Stop and Limit prices.
  • LimitMove - Works like a Limit order, but for entry orders the Backtester will not execute the simulated order if the bar opens beyond the order price. WealthLab's Quotes & Price Triggers tool also suppresses LimitMove triggers whose first recorded tick is already beyond the Price.
  • MarketClose - Executes the simulated order at the bar's closing price. See the usage notes below for same-bar and live-trading considerations.
  • LimitClose - Similar to MarketClose but with a Limit price constraint. If the closing price is not at or better than the Limit price, the order does not fill.
  • FixedPrice - A pseudo order type used primarily for backtest analysis. It executes at exactly the specified order price, which should fall within the bar's OHLC range. Market-On-Close and Limit-On-Close Usage Notes
  1. WealthLab can place Market On Close (MOC) and Limit On Close (LOC) orders with Brokers that support them. As a general rule, On-Close orders should be submitted sufficiently before the end of the session to participate in the closing auction. Brokers can reject or cancel orders submitted too late.
  2. The Backtester executes MarketClose and LimitClose orders on the following bar regardless of time scale. An intraday Strategy using On-Close orders for session-close logic should therefore place the order on the penultimate bar before the regular session close.
  3. Intraday Strategies generally should not use On-Close orders for ordinary midday trading. Use Market and Limit orders instead.
  4. For live trading behavior, see Preferences > Trading > Special Order Types > Use MOC/LOC when Possible. For hypothetical backtesting, you might want to analyze a completed bar and execute a MarketClose order on that same bar. This requires intentionally peeking at the following bar because Strategy logic normally cannot know the current bar's final values before its close. The example below demonstrates this technique. It suppresses the exit Signal on the final chart bar because no future bar exists to inspect.
Example Code
using WealthLab.Backtest;
using WealthLab.Core;
using WealthLab.Indicators;
using System.Drawing;
namespace WealthScript1
{
    public class MarketClosePeekingExitStrategy : UserStrategyBase
    {
        public override void Initialize(BarHistory bars)
        {
            smaShort = SMA.Series(bars.Close, 20);
            smaLong = SMA.Series(bars.Close, 50);
            PlotIndicator(smaShort, WLColor.Gold);
            PlotIndicator(smaLong, WLColor.Red);
            PlotStopsAndLimits(3);
        }
        public override void Execute(BarHistory bars, int idx)
        {
            if (!HasOpenPosition(bars, PositionType.Long))
            {
                if (bars.Close[idx] < smaShort[idx] && bars.Close[idx] < smaLong[idx])
                {
                    Transaction t = PlaceTrade(bars, TransactionType.Buy, OrderType.StopLimit, smaShort[idx], "StpLmt");
                    t.StopLimitLimitPrice = smaShort[idx] * 1.005;
                }
            }
            else
            {
                if (idx == bars.Count - 1)
                    return;
                if (smaShort.CrossesOver(smaLong, idx + 1))
                    PlaceTrade(bars, TransactionType.Sell, OrderType.MarketClose);
            }
        }
        private SMA smaShort;
        private SMA smaLong;
    }
}

ParameterType
public enum ParameterType

Represents the type of a Parameter used by WealthLab components such as Strategies and Indicators. Parameters are instances of the Parameter class. Possible values are:

  • Int32
  • Double
  • String
  • Boolean
  • TimeSeries
  • BarHistory
  • Color
  • LineStyle
  • Text
  • Font
  • StringChoice
  • Indicator
  • Smoother
  • IndicatorSource
  • PriceComponent
  • DataSet
  • ColorWpfDeprecated
  • HistoryScale
  • Date
  • Password
  • Label
  • SmootherType
  • IndicatorTSSource
  • DataRange

Remarks

  • Text - Exposes a string using a multiline text field in the user interface.
  • StringChoice - Exposes a string with a discrete set of possible values using a drop-down control.
  • IndicatorSource - Used internally to indicate that a Parameter obtains its source from another Indicator.
  • PriceComponent - Represents Open, High, Low, Close, Volume, or one of the calculated average-price components represented by the PriceComponent enum.

PeakTroughReversalType
public enum PeakTroughReversalType

Specifies the method a PeakTroughCalculator uses to determine peak and trough reversals. Possible values are:

  • Percent
  • Point
  • ATR
  • ATRPercent

PeakTroughType
public enum PeakTroughType

Specifies whether a PeakTrough instance represents a peak or a trough. PeakTrough instances are generated by the PeakTroughCalculator utility class. Possible values are:

  • Peak
  • Trough

PlotStyle
public enum PlotStyle

Specifies the plotting style used to render an Indicator or TimeSeries on a chart. Possible values are:

  • Line
  • Histogram
  • Dots
  • ThickLine
  • ThickHistogram
  • DottedLine
  • DashedLine
  • BooleanDots
  • Bands
  • ZigZag
  • Blocks
  • GradientBlocks
  • BarHistory
  • BarChart
  • HistogramTwoColor
  • Oscillator
  • Cloud
  • Mountain

Remarks

  • BooleanDots - Always plots in the price pane and draws a dot above a price bar whenever the Indicator value is greater than zero.
  • Bands - Renders filled bands based on the source Indicator and its BandCompanion. The companion Indicators should have their Bars property assigned to the same BarHistory. If a BandCompanion cannot be found, the Indicator plots as a line. You can alternatively use PlotIndicatorBands.
  • ZigZag - Intended for Indicators such as ZigZag that contain sporadic values separated by Double.NaN. WealthLab draws lines between the non-NaN values.
  • Blocks - Plots outlined blocks, with each block spanning a range of identical values. This style is useful for fundamental or regime data.
  • GradientBlocks - Similar to Blocks, but fills each block using a gradient.
Example Code
using WealthLab.Backtest;
using System;
using WealthLab.Core;
using WealthLab.Indicators;
using System.Collections.Generic;
namespace WealthScript123
{
    public class FilledBBands : UserStrategyBase
    {
        public override void Initialize(BarHistory bars)
        {
            bbl = BBLower.Series(bars.Close, 20, 2);
            bbu = BBUpper.Series(bars.Close, 20, 2);
            bbl.Bars = bars;
            bbu.Bars = bars;
            PlotIndicator(bbl, WLColor.Pink, PlotStyle.Bands);
            PlotIndicator(bbu, WLColor.Pink);
        }
        public override void Execute(BarHistory bars, int idx)
        {
        }
        private BBLower bbl;
        private BBUpper bbu;
    }
}

PositionType
public enum PositionType

Specifies whether a Position is Long or Short. Possible values are:

  • Long
  • Short

PriceComponent
public enum PriceComponent

Represents the components of historical market data and several price components derived by averaging the standard OHLC values. Possible values are:

  • Open
  • High
  • Low
  • Close
  • Volume
  • AveragePriceOHLC
  • AveragePriceHLC
  • AveragePriceHL
  • AveragePriceOC
  • AveragePriceHLCC

SignalStatus
public enum SignalStatus

Represents the possible states of an order during its lifetime while interacting with a Broker. Possible values are:

  • Staged
  • Placed
  • Active
  • Filled
  • PartialFilled
  • CancelPending
  • Canceled
  • Error
  • WaitForClose
  • Published
  • FinalOrder
  • HeldForReview
  • Killed

StrategyExecutionMode
public enum StrategyExecutionMode

Specifies the context in which the Backtester is executing a Strategy. The current value is available through the Backtester's ExecutionMode property. Possible values are:

  • Strategy
  • Optimization
  • StreamingChart
  • StrategyMonitor
  • Rankings
  • Evolver
  • SignalPublisher
Example Code
using WealthLab.Backtest;
using System;
using WealthLab.Core;
using WealthLab.Indicators;
using System.Drawing;
using System.Collections.Generic;
namespace WealthScript1
{
    public class MyStrategy : UserStrategyBase
    {
        public override void Initialize(BarHistory bars)
        {
            DrawHeaderText(ExecutionMode.ToString(), WLColor.Blue, 16);
            switch (ExecutionMode)
            {
                case StrategyExecutionMode.Optimization:
                    _isOptimization = true;
                    break;
                case StrategyExecutionMode.Strategy:
                    _isStrategyWindow = true;
                    break;
                case StrategyExecutionMode.StrategyMonitor:
                    _isStrategyMonitor = true;
                    break;
                case StrategyExecutionMode.StreamingChart:
                    _isStreaming = true;
                    break;
                default:
                    break;
            }
        }
        public override void Execute(BarHistory bars, int idx)
        {
        }
        bool _isStreaming;
        bool _isOptimization;
        bool _isStrategyWindow;
        bool _isStrategyMonitor;
    }
}

TextShape
public enum TextShape

Provides special symbols that can be rendered with methods such as DrawBarAnnotation, including triangles, circles, squares, and stars. Possible values are:

  • TriangleUp
  • TriangleDown
  • TriangleHollowUp
  • TriangleHollowDown
  • SquareFilled
  • SquareHollow
  • SquareLeftTick
  • SquareRightTick
  • CircleHollow
  • CircleFilled
  • CircleCrosshair
  • CircleWithX
  • DiamondFilled
  • DiamondHollow
  • HexagonFilled
  • HexagonHollow
  • ArrowUp
  • ArrowDown
  • ArrowRight
  • ArrowLeft
  • ArrowRightLeft
  • StarFilled
  • StarHollow
  • Star8Points
Example Code
using WealthLab.Backtest;
using System;
using WealthLab.Core;
using WealthLab.Indicators;
using System.Collections.Generic;
namespace WealthScript1
{
    public class MyStrategy : UserStrategyBase
    {
        public override void Initialize(BarHistory bars)
        {
            ptc = new PeakTroughCalculator(bars.Close, 5.0, PeakTroughReversalType.Percent);
            foreach (PeakTrough pt in ptc.PeakTroughs)
            {
                if (pt.Type == PeakTroughType.Trough)
                    DrawBarAnnotation(TextShape.TriangleHollowUp, pt.XIndex, false, WLColor.Lime, 16);
                else
                    DrawBarAnnotation(TextShape.TriangleHollowDown, pt.XIndex, true, WLColor.Red, 16);
            }
        }
        public override void Execute(BarHistory bars, int idx)
        {
        }
        PeakTroughCalculator ptc;
    }
}

TradingDayChoice
public enum TradingDayChoice

Identifies a calendar period used by trading-day utility methods that calculate elapsed or remaining trading days. Possible values are:

  • Weekly
  • Quarterly
  • Monthly

TrailingStopType
public enum TrailingStopType

Specifies how a trailing stop is calculated when using the CloseAtTrailingStop method of UserStrategyBase. Possible values are:

  • PercentC
  • PointC
  • PercentHL
  • PointHL
  • ATR

Remarks

  • PercentC - Uses a percentage distance above or below price and updates from closing prices.
  • PercentHL - Uses a percentage distance and updates from Highs for Long Positions and Lows for Short Positions.
  • PointC - Uses a fixed-point distance above or below price and updates from closing prices.
  • PointHL - Uses a fixed-point distance and updates from Highs for Long Positions and Lows for Short Positions.
  • ATR - Uses an ATR-based distance and updates from Highs for Long Positions and Lows for Short Positions. For a Chandelier-style exit, the distance from the highest or lowest point to the trailing stop is expressed in units of ATR.

TransactionType
public enum TransactionType

Specifies the type and direction of a Transaction or order. Possible values are:

  • Buy
  • Sell
  • Short
  • Cover

VerticalAlignment
public enum VerticalAlignment

Specifies the vertical alignment used by methods such as DrawTextVAlign. Possible values are:

  • Bottom
  • Center
  • Top