SetUnitCustomValue

Top  Previous  Next

Sets the custom value field of the unit.

 

There must be a position on, so this cannot be used in the Unit Size, Can Add Unit, or Can Fill Order scripts unless there is already a unit on and the intention is to reference the current open position unit and not the current order. In these scripts the order is being processed so the order object should be used if that is the intention.

 

This function is best used in the Entry Order Filled, Exit, Entry, or After Instrument Day scripts.

 

Syntax

 

SetUnitCustomValue( [unitNumber,] value )

 

Parameters

unitNumber

 

the unit number (optional). If not supplied this will default to the first unit

value

 

the custom value to be set. This value can be retrieved using the unitCustomValue property.

 

Example

' Set the custom value.

instrument.SetUnitCustomValue( 1.5 )

 

PRINT "The custom value is ", instrument.unitCustomValue

' Prints 1.5