ExitUnitOnStop

Top  Previous  Next

Exits the specified unit for the current instrument on the next bar if the market goes lower than the stop price for long positions or higher than the stop price for short positions. This function is generally used by an Exit Block to lighten up a position.

 

Syntax

 

ExitUnitOnStop( unitNumber, stopPrice, [ quantity ] )

 

Parameters

unitNumber

 

the unit to exit

stopPrice

 

the price which the next bar must exceed to trigger the order

quantity

 

the optional quantity to exit for a partial exit of the unit

 

Example

' Exit the first unit if the market hits our stop.

broker.ExitUnitOnStop( 1, exitStop )