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.


SetUnitCustomValue( [unitNumber,] value )





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


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



' Set the custom value.
instrument.SetUnitCustomValue( 1.5 )
PRINT "The custom value is ", instrument.unitCustomValue


When value is printed, it will show the value entered.  In this example, 1.5 will appear.  Value will also appear in the Trade Log.




See Also:

Position Functions


Edit Time: 5/25/2017 10:43:46 AM

Topic ID#: 564


Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software