Convert stop to trailing stop after profit

Hello!

I have all of my trade signals working but now having some issues with execution or best way to execute the trade. Here is an example scenario:

  • I get a long signal, which I first execute with a defined stop + target profit
  • Once I hit a certain amount of profit, I’d like the stop to turn into a trailing stop starting at breakeven or some trailing amount.

I’m using the content in this post as initial thoughts: modifyOrderStrategy command schema - #2 by Howard but it doesn’t quite handle my use case

I know in the UI of tradovate, we have options of having an “Auto-breakeven” stop. I have a vague suspicion I could submit a trailing stop after my code watches the trade for whatever initial profit I want (or update the existing order?) but was wondering if there is a way to “finesse” it on Tradovate server-side.

Thanks!

As it stands there is no ‘native’ way to do this. You can watch for events via websocket, and send orders based on what happens in real-time. But keep in mind: disconnects can affect the outcome of a strategy that relies on watching events to escape a bad position, rather than a bracket strategy/OCO/OSO which is guaranteed to work within its good-until period, stable connection or not. Relying on this type of mechanism to take excess profit in select scenarios sounds less risky, however.

With that in mind and the disclaimer above, watch for the execution of your profit-target order from the WebSocket. You’re looking for an event object like this:

{ e: 'props', entityType: 'executionReport', entity: ExecutionReport }

Once filled, you can submit a trailing stop via API as an attempt to continue to ride the momentum of a market move. I’d suggest the trailing stop because it will automatically tap out, so once submitted you won’t have to watch the websocket events anymore.

I would not suggest using this strategy to close via market order, or to close positions using /order/liquidatePosition. Additionally, relying on a similar strategy to call order/cancelOrder is also not advised (a disconnected websocket can’t cancel an order, for example).