SetStopLoss()
Previous Topic  Next Topic 

Definition
Generates a stop loss order to exit a position. Stop loss orders are real working orders (unless simulated is specified in which case the stop order is locally simulated and submitted as market once triggered) submitted immediately to the market upon receiving an execution from an entry order.


Syntax
SetStopLoss(double currency)

SetStopLoss(double currency, bool simulated)

SetStopLoss(CalculationMode mode, double value)

SetStopLoss(string fromEntrySignal, CalculationMode mode, double value, bool simulated)


Parameters

currency

Sets the stop loss amount in currency ($500 loss for example)

simulated

If true, will simulate the stop order and submit as market once triggered

mode

CalculationMode.Percent (0.01 = 1%)

CalculationMode.Price

CalculationMode.Ticks

value

The value the stop loss order is offset from the position entry price (exception is using .Price mode where 'value' will represent the actual price)

fromEntrySignal

The entry signal name. This ties the stop loss exit to the entry and exits the position quantity represented by the actual entry.


Examples

protected override void Initialize()
{
    // Submits a stop loss of $500
    SetStopLoss(500);
}


Tips (also see Overview)