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 )

 

Parameter:

Description:

[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
 

Returns:

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.

 

Links:

 

See Also:

Position Functions

 


Edit Time: 9/25/2017 09:09:54 AM


Topic ID#: 564

 

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