Strategy Field

Stop loss type

The Stop loss type field allows you to control the order type of stop loss leg that is sent to the broker with your entry order. You can also control this from your webhook with the stopLoss.type parameter. The allowed values for this field are:

  • stop - A stop market order.
  • stop_limit - A stop limit order.
  • trailing_stop - A trailing stop order.

Stop Market

A stop market order is an order that is converted to a market order when the stop price is reached. This means that the order will be executed at the best available price after the stop price is reached. This type of order is typically used to limit losses on a position.

{
    "ticker": "AAPL",
    "action": "buy",
    "orderType": "limit",
    "limitPrice": 100,
    "stopLoss": {
        "type": "stop",
        "stopPrice": 90
    }
}

You can also calculate relative stop loss stop prices using the stopLoss.amount or stopLoss.percent field. Here is an example of a stop loss that is $10 below the entry price and would be calculated as 90 in the above example:

{
    "ticker": "AAPL",
    "action": "buy",
    "orderType": "limit",
    "limitPrice": 100,
    "stopLoss": {
        "type": "stop",
        "amount": 10
    }
}

Or use a percentage instead of a fixed dollar amount:

{
    "ticker": "AAPL",
    "action": "buy",
    "orderType": "limit",
    "limitPrice": 100,
    "stopLoss": {
        "type": "stop",
        "percent": 10
    }
}

Stop Limit

A stop limit order is an order that is converted to a limit order when the stop price is reached. This means that the order will be executed at the limit price or better after the stop price is reached. This type of order is typically used to limit losses on a position while also controlling the price at which the order is executed. This order has a lower likelyhood of being filled compared to a stop market order so usually it is not desired for stop losses.

{
    "ticker": "AAPL",
    "action": "buy",
    "orderType": "limit",
    "limitPrice": 100,
    "stopLoss": {
        "type": "stop_limit",
        "stopPrice": 90,
        "limitPrice": 89
    }
}

Trailing Stop

A trailing stop order is an order that is adjusted as the price of the security moves in your favor. The stop price is set as a percentage or dollar amount below the current market price, and is adjusted as the price of the security moves up. This type of order is typically used to lock in profits on a position while allowing the position to continue to run if the price moves in your favor.

{
    "ticker": "AAPL",
    "action": "buy",
    "orderType": "limit",
    "limitPrice": 100,
    "stopLoss": {
        "type": "trailing_stop",
        "trailAmount": 5
    }
}

You can also represent your trailing stop in terms of a percentage instead of a fixed dollar amount:

{
    "ticker": "AAPL",
    "action": "buy",
    "orderType": "limit",
    "limitPrice": 100,
    "stopLoss": {
        "type": "trailing_stop",
        "trailPercent": 5
    }
}

Ready to automate your trading? Sign up for free today.