orderStrategy With a mix of OCO and OSO

Is it possible with the orderStrategy feature to send a mix of OCO and OSO ?

What I am trying to do is have a stop loss and profit target, and if the profit target is hit then it only closes say 50% of the position, leaving the remaining 50% with a trailing stop loss (eg a runner type approach).

I have the OCO working with just a profit and stop loss, but have not been able to figure out how to setup something like the above.

To answer your question, I don’t know.

Perhaps more important, is that Tradovate has broken the strategyOrder. They have barely acknowledged it and have removed it from their web Trading platform.(I can’t find it anymore at least) Those of us who were using the API have been unable to even get their previously working examples to function.

Sadly, until they fix it there’s not much you can do. It also doesn’t seem like a priority since it’s been well over a month since the issue was identified.

Yeah I saw that post… I had no issues getting strategyOrder to work on the market replay socket, not tried on Demo or Live yet.

Hi @Mikeb,

You could actually execute the strategy that you want via API without startOrderStrategy.

What you’d do is place 2 separate OSOs. They’d both have the same entry parameters, but one would have a bracket1 parameter that was just a trailing stop. The other would have both bracket1 and bracket2 parameters filled in, creating an OCO. One would be a trailing stop, the other would be a take profit to sell the 50% of your initial position. Then the uncapped one will trail until it either taps out with the capped order, or it will continue beyond your first profit target.

You can use the orderType field in the brackets to specify the type among these:
"Limit" "Market" "Stop" "StopLimit" "TrailingStop" "TrailingStopLimit".

Each order type’s required parameters may vary - TrailingStopLimit needs both a price and a stopPrice while a Limit only needs price.

Thanks, can this be placed at the same time the original order entry goes in ? eg so I don’t have to have a risk of a position getting filled and then not having the exit orders applied

Yes, it would all be defined right away. Here’s some example JS (this is untested code) for a possible version of that:

const firstOSO = {
  accountSpec: yourUserName, 
  accountId: yourAccountId,
  action: 'Buy',
  symbol: 'ESH2',
  orderQty: 1,
  orderType: 'Limit',
  price: 4500,
  isAutomated: true,
  bracket1: {
    action: 'Sell',
    orderType: 'TrailingStop',
    price: 4480.00
  }
}

const secondOSO = {
  //...same params
  bracket1: {/*...*/},
  bracket2: {
    action: 'Sell',
    orderType: 'Limit',
    price: 4510.00
  }
}

myWebSocket.send(`order/placeoso\n23\n\n${JSON.stringify(firstOSO)}`)
myWebSocket.send(`order/placeoso\n24\n\n${JSON.stringify(secondOSO)}`)

Each OSO when filled will the send the linked exit orders. You could play with the orderType parameters for your bracket1 and bracket2 fields a bit too - try a regular stop on one combined with a trailing stop on the other maybe (or even a trailing stop limit), depending on your preferences.

Alexander, first of all let me thank you for all the great help you are providing on this forum.
I was wondering if there is a way, via the placeoso or placeoco endpoints to have brackets that specify a take profit target by ticks or delta price.
I understand we can set hardcoded trailingstop and limit orders with calculated prices targets, but I was wondering if there is a way, just like we can do in startorderstragy and specify profitTarget and stopLoss in ticks.

You’ll likely need to write something by hand. What you’d do is take the entry order’s price. Then you’d use a parameter or something to specify TP/SL. Something like this maybe (untested/pseudo-code):

async function startStrategy(entry, tp, sl) {
  const bracket1 = {
    //...
    price: entry.price + tp
  }

  const bracket2 = {
    //...
    price: entry.price - sl
  }
  await placeOSO(entry, bracket1, bracket2)
}

This is completely fabricated code, but I think you should be able to get the general idea.