Search Framework:
PositionSize
Namespace: WealthLab.Backtest
Parent: Object

Represents the position sizing that was established for a backtest.

Members
Amount
public double Amount

The amount of the position sizing method. Represents different things depending on how the PositionSizeType property is set.


MarginFactor
public double MarginFactor

The margin factor to use for the backtest.


MaxOpenPositions
public int MaxOpenPositions

The maximum number of open positions to allow at one time during the backtest, or zero for no limit.


MaxOpenPositionsInSymbol
public int MaxOpenPositionsInSymbol

The maximum number of open positions per symbol to allow at one time during the backtest, or zero for no limit.


MaxOpenPositionsLong
public int MaxOpenPositionsLong

The maximum number of open long positions to allow at one time during the backtest, or zero for no limit.


MaxOpenPositionsShort
public int MaxOpenPositionsShort

The maximum number of open short positions to allow at one time during the backtest, or zero for no limit.


PositionSizer
public PositionSizerBase PositionSizer

Contains the instance of the PositionSizer selected, if PositionSizeType is equal to PosSizer.


PositionSizeType
public PositionSizeType PositionSizeType

The position sizing method employed. Possible values for the PositionSizeType enum are:

  • Dollar - a fixed currency amount
  • Quantity - a fixed number of shares/contracts
  • PctOfEquity - a percentage of the current simulated equity
  • MaxRiskPct - risks a percentage of the current simulated equity based on a risk stop level (see GetMaxRiskStopLevel);
  • PosSizer - use a PositionSizer instance for more advanced position sizing

StartingCapital
public double StartingCapital

The backtest starting capital.


UseNextBarOpenAsBasisPrice
public bool UseNextBarOpenAsBasisPrice

Determines how the cost basis of a simulated trade is established. If false (which is the default value), the cost basis of a Transaction is established using the closing price of the entry bar. If the market gaps up the following day, it's possible that trades could be missed and result in NSF status (non-sufficient funds). If set to true, the cost basis of a Transaction is based on the open price of the next bar. This avoid the problem of the market gapping up and potentially missing simulated trades, but assumes that the executing broker allows orders to be specified in dollar (currency) values rather than shares/contracts.