You currently canât place this as one order. Youâll have to place a buy stop order at 901. You'll then have to send in a sell trail at 1. You could place this as one order using the Excel spreadsheet. Where you could set-up an âif filledâ order, which would send the trailing stop when the buy stop had been activated. The TWS User Guide gives guidelines of how to set-up and âif filledâ order. To use the API for this should be fairly simple.
Turns out this feature will be in the next release. If you like, you can try it via the beta on the site now. From the release notes: Bundled trailing stop orders TWS now allows you to use bundled trailing stop orders. To create a bundled trailing stop, create a limit order, then right-click on the limit order and select "Attach Trailing Stop" from the popup menu. The bundled trailing stop order will become active when the associated limit order is filled.
def, you should know better than me, but check this out. If you use the buy with trailing stop hotkey, and then change the limit order to stop, I'm thinking that would work. I don't know, but when I hit the cancel hotkey, even though the limit has been changed to stop, it cancels both orders, so tws must still think they are linked. (not in the mood to place any accidental orders tonight) if anyone tries it let me know