Enhance Your Trading with Customizable Order Types in TradersPost

Fact checked by
Jonathan Wage
June 4, 2024
With the latest update to TradersPost, you can now control the order type directly from webhooks using the new orderType field. This optional field allows you to specify the type of order—market, limit, stop_limit, stop, or trailing_stop—providing greater flexibility and precision in your trading strategies. If not specified, the default order type configured in your strategy subscription settings will be applied. Explore how to use each order type with practical JSON examples, and take your automated trading to the next level.

You can now control the order type from webhooks with the new field named orderType. The orderType field is optional. If not specified, the default order type configured in your strategy subscription settings will be applied. The supported values for the orderType field are:

  • market
  • limit
  • stop_limit
  • stop
  • trailing_stop

Market Order

A market order is the simplest type of order, executed immediately at the current market price. This ensures quick execution but does not guarantee a specific price.

{
    "ticker": "SQ",
    "action": "buy",
    "orderType": "market"
}
Language:JSON

Limit Order

A limit order allows you to specify the maximum price you are willing to pay when buying a stock, or the minimum price you are willing to accept when selling a stock. This ensures that you do not pay more or receive less than this specified price for the stock.

For example, to set up a limit order to buy the ticker symbol SQ at a maximum price of $200, you would use the following JSON structure:

{
    "ticker": "SQ",
    "action": "buy",
    "orderType": "limit",
    "limitPrice": 200
}
Language:JSON

Stop Limit Order

A stop limit order combines the features of a stop order and a limit order. When you place a stop limit order, you specify two prices: the stopPrice and the limitPrice. The order will only be executed at the specified limit price or better, but only after the stock price reaches the stop price. This type of order gives you control over the price at which the order should be executed, helping to limit losses or protect profits.

For example, to place a stop limit order for the ticker symbol SQ to buy at a limit price of $200 only after the price rises to $201, you would use the following JSON structure:

{
    "ticker": "SQ",
    "action": "buy",
    "orderType": "stop_limit",
    "stopPrice": 201,
    "limitPrice": 200
}
Language:JSON

In this example, the action is set to "buy," indicating a purchase. The orderType is stop_limit, specifying that this is a stop limit order. The stopPrice is set at $201, which is the price the stock must reach before your limit order is placed. Finally, the limitPrice is set at $200, indicating the maximum price you are willing to pay per share.

Trailing Stop Order

In this example, the orderType is trailing_stop, featuring a trailPercent of 2%. This configuration means that the order to sell the stock will activate when its price falls 2% below its peak value since the order's initiation. This mechanism allows investors to safeguard their gains by setting up an automatic sell trigger in response to price declines.

{
    "ticker": "SQ",
    "action": "sell",
    "orderType": "trailing_stop",
    "trailPercent": 2
}
Language:JSON

Instead of a percentage, you can specify a trailing stop order with a fixed dollar amount using the trailAmount field. This means the order will be executed once the asset's price moves against the direction of the trade by the specified dollar amount from its peak value since the order was placed.

{
    "ticker": "SQ",
    "action": "sell",
    "orderType": "trailing_stop",
    "trailAmount": 5
}
Language:JSON

In this example, buying MSFT stocks is triggered when their price decreases by $5 from the highest price since the order was placed. This method is particularly useful for stocks with higher volatility, as it allows for more precise control over the execution price.

Conclusion

With the addition of the orderType field in TradersPost, you now have more control and flexibility over your trading strategies. Whether you're using market orders, limit orders, stop orders, or trailing stops, you can tailor each trade to fit your specific needs. We hope you find these new options useful and that they help you achieve your trading goals more effectively. If you have any questions or need assistance, our team is here to help. Happy trading!

Ready to automate your trading? Try a free 7-day account:
Try it for free ->