Position Properties

Top  Previous  Next

Unit Indexing

Properties listed with a '[ ]' following them may be indexed using a number which determines the unit. If no index is supplied the property will return the information for the first unit. For example:

 

firstUnitQuantity = instrument.unitQuantity[ 1 ]

 

will access the quantity for the first unit for a position of this instrument.

 

Current Position Properties:


 


position

 

the current position, represented by the numerical constants SHORT, OUT, or LONG.

positionDescription

 

the current position as a string (equal to "Long", "Short", or "Out"). Useful for printing.

currentPositionUnits

 

the total number of units on for the current position

currentPositionQuantity

 

the total number of contracts or shares on for the current position

currentPositionProfit

 

the 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.

currentPositionRisk

 

the total risk for this position, in dollars, based on the close and the stop prices

barsSinceExit

 

the number of bars since the last exit, regardless of unit

 

 

Unit Specific Properties:


 


unitEntryDate[ ]

 

the entry date of the unit

unitEntryTime[ ]

 

the entry time of the unit

unitEntryDayIndex[ ]

 

the day index of the entry

unitEntryOrder[ ]

 

the order price for the unit

unitEntryFill[ ]

 

the fill price for the unit

unitQuantity[ ]

 

the quantity for the unit

unitExitStop[ ]

 

the exit stop for the unit as set by the original broker function call, or set by SetExitStop

unitNoExitStop[ ]

 

returns true if there is no exit stop set for the unit. Useful for cleaner reporting.

unitExitLimit[ ]

 

the exit limit for the unit as set by SetExitLimit

unitEntryRisk[ ]

 

the entry risk for the unit adjusted by the fill price

unitProfit[ ]

 

the open profit of the trade, net of commissions etc, in instrument currency.

unitRollProfit[ ]

 

the accrued closed profit of the futures trade for all rolls, in base currency.

unitRollCommission[ ]

 

the accrued commission of the futures trade from all rolls, in base currency.

unitRollSlippage[ ]

 

the accrued slippage of the futures trade from all rolls, in base currency.

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.

unitCarry[ ]

 

the total carry cost of the unit for forex trades.

unitBarsSinceEntry[ ]

 

the number of bars since the entry of this unit

unitCustomValue[ ]

 

the custom value as set through scripting into the unit, or the order that created the unit. Float value.

unitRuleLabel[ ]

 

the rule label as set through scripting into the unit, or into the order that created the unit. String value.

unitMaxFavorableExcursion[ ]


the maximum favorable excursion of the unit

unitMaxAdverseExcursion[ ]


the maximum unfavorable excursion of the unit

unitMinFavorableExcursion[ ]


the minimum favorable excursion of the unit

unitDeliveryMonth[ ]


the delivery month (YYYYMM) of the unit