Your interactive trading laboratory!
 • 
27 users online

Quantacula Help

How-To
C# API Reference
Extensions
Development Blog
API-Extensions
Indicator Spotlights

QCommunity Extensions
The open-source GitHub repository of source code for the QCommunity Extensions library. Contains indicators and other extensions submitted by the Quantacula Community. Look for QCommunity indicators when you create a Building Block model, mark the "QCommunity" library check box to expose them.

TASC-Extensions
The open-source GitHub repository of source code for the TASCExtensions Quantacula extension. Contains indicators and other extensions adapted from the Traders' Tips articles in Technical Analysis of Stocks & Commodities magazine.
Position
Namespace: Quantacula.Backtest
Parent: Object

The Position class represents a long (result of a buy order) or short (result of a sell short order) position that was generated by the backtester.

Members

Bars
public BarHistory Bars

Returns the BarHistory instance that this Position was based on.


BarsHeld
public int BarsHeld

Returns the number of bars that the position was held.


Commission
public double Commission

Returns the total commission (entry plus exit) for the Position.


CostBasis
public double CostBasis

Returns the cost basis for the Position. This is the Position's EntryPrice multipled by its Quantity. In Futures Mode, it is the symbol's Margin multipled by Quantity.


EntryBar
public int EntryBar

Returns the bar number into the source BarHistory (Bars property) where the Position entry occurred.


EntryCommission
public double EntryCommission

Returns the entry commission for the Position.


EntryDate
public DateTime EntryDate

Returns the DateTime the Position was entered.


EntryPrice
public double EntryPrice

Returns the price at which the Position was entered.


ExitBar
public int ExitBar

Returns the bar number into the source BarHistory (Bars property) where the Position exit occurred. If the Position is still open, returns -1.


ExitCommission
public double ExitCommission

Returns the exit commission for the Position.


ExitDate
public DateTime ExitDate

Returns the DateTime the Position was exited. If the Position is still open, returns DateTime.MaxValue.


ExitPrice
public double ExitPrice

Returns the price at which the Position was exited. If the Position is still open, returns zero.


FuturesMode
public bool FuturesMode

Returns true if the Position was operating under Futures Mode. This will be true if Futures Mode was turned on in Backtest Settings, and the Position's symbol (Bars.Symbol) has a Point Value and Margin defined.


IsOpen
public bool IsOpen

Returns true if the Position is currently open (not yet exited).


PositionTag
public int PositionTag

Contains an int tag value that you can establish at the time the Position is entered. The PlaceTrade method has a positionTag parameter where you can tag Positions for identification. These Positions can be located at a later point by calling FindPosition.


PositionType
public PositionType PositionType

Returns the position type, possible values are PositionType.Long and PositionType.Short.


Profit
public double Profit

Returns the profit of the Position, with commissions deducted.


ProfitPct
public double ProfitPercent

Returns the percentage profit of the Position, with commissions deducted.


Quantity
public double Quantity

Returns the number of shares or contracts that comprise the Position.