SetExitLimit

Top  Previous  Next

Sets the exit limit for the specified unit.

There must be a position on, so this cannot be used in the Unit Size, Can Add Unit, or Can Fill Order scripts. In these scripts the order is being processed so the order object should be used.

This function can be used in the Entry Order Filled, Exit, Entry, Adjust Stops, or After Instrument Day scripts.

 

Syntax

 

SetExitLimit( [unitNumber,] limitPrice )

 

Parameters

unitNumber

 

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

limitPrice

 

the value of the limit to be set.

 

Example

' Set the limit price.

instrument.SetExitLimit( limitPrice )

 

 

' Set the limit price for the specified unit.

instrument.SetExitLimit( unitNumber, limitPrice )

 

NOTE: If you set the limit with this function no order is placed. To place an actual limit order in the market use a broker order like this: broker.ExitAllUnitsAtLimit( instrument.unitExitLimit ).