Active trade information is made available by accessing these Instrument Position Properties.
Properties listed with a '[ ]' following them may be indexed using a number. Index number is to identify which unit in the position a property is to reference.
' This statement will return the position quantity, in
' contracts or shares, for the FIRST unit in the position
firstUnitQuantity = instrument.unitQuantity[ 1 ]
Position can have more than one unit. To discover how many units are in a position use this property:
' Count Position Units
UnitCount = instrument.currentPositionUnits
When a position has more than one unit change the value index value to reference that unit.
' This statement will return the position quantity, in
' contracts or shares, for the SECOND unit in the position
firstUnitQuantity = instrument.unitQuantity[ 2 ]
When no index is supplied the property will return the information for the first unit "[ 1 ]".
' This statement will return the position quantity, in
' contracts or shares, for the FIRST and possibly the
' ONLY unit in the position
firstUnitQuantity = instrument.unitQuantity
Syntax: |
---|
value = instrument.<position-property-name> [ index ] |
Position Properties: |
Descriptions: |
||||||||
---|---|---|---|---|---|---|---|---|---|
barsSinceExit |
Number of bars since the last exit, regardless of unit |
||||||||
currentPositionGrossProfit |
Gross profit is the basic profit computation, while net (currentPositionProfit) includes roll commission, entry commission, custom commission, roll slippage carry cost, dividends, and saved walk forward profit. |
||||||||
currentPositionProfit |
Total profit, in dollars, using the current close, of all units in the current position. This includes roll profit, slippage, and commission that has already moved to closed equity, as well as forex carry and stock dividends. Does not include future expected commission for the trade once it has closed. |
||||||||
currentPositionQuantity |
Total number of contracts or shares on for the current position |
||||||||
currentPositionRisk |
Total risk for this position, in dollars, based on the close and the stop prices |
||||||||
Total number of units on for the current position |
|||||||||
position |
Current position, represented by the numerical constants SHORT, OUT, or LONG. |
||||||||
positionDescription |
Current position as a string equal to SHORT, OUT, or LONG. Useful for printing. |
||||||||
purchaseEquity |
For use with active stock positions. A stock's Initial equity position amount required to purchase a current positions (entry fill price times the instrument's current share quantity) is returned.. |
||||||||
system |
System index for the this instrument's position. |
||||||||
systemMarketOrderNetQuantity |
Total net quantity (long minus short) for that instrument/system or market on open orders |
||||||||
unitBarsSinceEntry[ ] |
The number of bars since the entry of this unit |
||||||||
unitCarry[ ] |
The total carry cost of the unit for forex trades. |
||||||||
unitCommission[ ] |
The computed commission that will be applied to the trade when the position exits. |
||||||||
unitCustomCommission[ ] |
The accrued custom commission added to the instrument through the use of the AddCommission function. |
||||||||
unitCustomValue[ ] |
The custom value as set through scripting into the unit, or the order that created the unit. Float value. |
||||||||
unitDeliveryMonth[ ] |
The delivery month (YYYYMM) of the unit |
||||||||
unitEntryDate[ ] |
The entry date of the unit |
||||||||
unitEntryDayIndex[ ] |
This property return is the bar index count since entry. |
||||||||
unitEntryFill[ ] |
The fill price for the unit |
||||||||
unitEntryFillTime |
Function returns an integer indicating the type of fill that happened. |
||||||||
unitEntryOrder[ ] |
The order price for the unit |
||||||||
unitEntryRisk[ ] |
The entry risk for the unit adjusted by the fill price |
||||||||
unitEntryTime[ ] |
The entry time of the unit |
||||||||
unitExitLimit[ ] |
The exit limit for the unit as set by SetExitLimit |
||||||||
unitExitStop[ ] |
The exit stop for the unit as set by the original broker function call, or set by SetExitStop |
||||||||
unitMaxAdverseExcursion[ ] |
The maximum unfavorable excursion of the unit |
||||||||
unitMaxFavorableExcursion[ ] |
The maximum favorable excursion of the unit |
||||||||
unitMinFavorableExcursion[ ] |
The minimum favorable excursion of the unit |
||||||||
unitNoExitStop[ ] |
Returns true if there is no exit stop set for the unit. Useful for cleaner reporting. |
||||||||
unitPositionReferenceID[ ] |
New orders are given a the unique reference ID. This ID number is assigned to the position when it is enabled. It is then available from this property. See Order Properties |
||||||||
unitProfit[ ] |
The open profit of the trade, net of commissions etc, in instrument currency. |
||||||||
unitQuantity[ ] |
The quantity for the unit |
||||||||
The accrued commission of the futures trade from all rolls, in base currency. |
|||||||||
The roll price is the last roll price, which is the price at which the open equity was moved to closed. So from this price you can compute new unaccrued profit |
|||||||||
The accrued closed profit of all the Futures rolls in the trade is returned in the simulation's base currency |
|||||||||
The accrued slippage of the futures trade from all rolls, in base currency. |
|||||||||
unitRuleLabel[ ] |
The rule label as set through scripting into the unit, or into the order that created the unit. String value. |
||||||||
unitSavedWFProfit[ ] |
|
||||||||
unitStockDividends |
|
||||||||
usedMargin |
Each symbol's in use margin amount in a stock or a futures system. |
Links: |
---|
See Also: |
|
Edit Time: 10/31/2020 1:04:09 PM |
Topic ID#: 468 |