开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: Placing Trailing Stop Limit Orders


 

开云体育

Hi,

TWS documentation has good examples




And the order reference

I’m using it like this and it works,?trailing_percent=1.5

In your case, you are missing a few fields there. As per the example from TWS

order = Order()
order.action = action
order.orderType =?"TRAIL LIMIT"
order.totalQuantity = quantity
order.trailStopPrice = trailStopPrice
order.lmtPriceOffset = lmtPriceOffset
order.auxPrice = trailingAmount

Trailing Stop Limit orders can be sent with the trailing amount specified as an absolute amount, as in the example below, or as a percentage, specified in the trailingPercent field.

In any case, there is nothing like testing different options until it works.


On 13 Jul 2024, at 17:52, R Malhotra <rachan.malhotra@...> wrote:

Hello,

Anyone who uses this order type, can you please confirm whether this code is correct to create an order with 1% trail? Most interested in the 'trailingPercent' field i.e. whether to pass the percent value as 1 or 0.01.

Are there any other fields needed for the order to correctly execute?

Thanks so much!

trailingStopOrder = ibi.Order(action=closingAction, totalQuantity=acccountPosition.position, orderType='TRAIL LIMIT', trailingPercent=1, account=acccountPosition.account, outsideRth= True, tif= "DAY")

Join [email protected] to automatically receive all group messages.