How to cancel limit order if market would immediately trigger stop loss condition?

Discussion in 'Interactive Brokers' started by ET180, Jun 13, 2020.

  1. ET180

    ET180

    Say I enter some bracket limit orders in the evening for the next day. For a long, I give my entry limit price, a stop loss at a lower price, and a take profit price. Once the entry executes, the stop loss and take profit orders become active. But what if the market is already trading below the stop loss price in pre-market? In that case, I want to cancel my order as if it was left to execute, once the market opens, it would execute the limit buy order and immediately sell a market order to close the position due to the activated stop loss. How do I avoid that situation? One idea would be to add a conditional order that cancels the trade if price is less than the stop loss. But it's not clear to me how that would work based on the trigger options described here:

    https://www.interactivebrokers.com/...nfiguretws/modify_the_stop_trigger_method.htm

    It looks like there would be a race condition between the market executing the limit order and the conditional triggers. Which happens first? The trigger recognizes a last price or bid / ask that violates the price condition and cancels the order or the order has already executed by the market? One way around this would be to place two conditional orders, one that cancels and one that is required to be met for the order to be active. Use price condition that price is less than stop loss, cancel trade to cancel the trade. Use another condition to require that price > stop loss in order to activate the entry order. But unfortunately, the cancel or activate conditions can't be mixed -- I can't have one condition that cancels and another condition that activates. Anyhow, I imagine that others have faced this situation. Anyone have a good solution?
     
    TradeTune likes this.
  2. neke

    neke

    You might want to put in some code on your part. That gives a lot more flexibility if not watching the market.
     
  3. zdreg

    zdreg

    Are you familiar with the principle of KISS?
     
    murray t turtle likes this.
  4. comagnum

    comagnum

    With IB bracket orders for the stop loss & profit target you can configure it using # of ticks or percentage distance from the parent order (entry price).
     
    TradeTune likes this.
  5. ET180

    ET180

    Shouldn't be necessary...actually, should be an option to kill the order if the market conditions are such that the stop loss would be immediately triggered after the order goes active.
     
    TradeTune likes this.
  6. ET180

    ET180

    Yes. And not sure why you asked the question. The simple solution would be taking unnecessary losses.
     
  7. ET180

    ET180

    That's not the issue. Here's what I'm trying to do. Place buy order for XYZ at 50, stop loss at 49, take profit at 52. Order submitted after market closes, GTC for hopeful execution the following day. Last Thursday happens and XYZ is trading pre-market at 48.15. I want my order killed which is where the conditional order comes in. Otherwise, doing nothing would mean that the limit order would immediately execute at around 48.15, then stop loss would immediately submit market order to close the position at around the same price just entered depending on liquidity. Instead, there should be an order option to say that if the market is trading at or below stop-loss at entry, just kill the order and save the unnecessary loss. One would think by default the broker would already do this without needing to submit a conditional order.
     
    murray t turtle likes this.
  8. This is of course possible if you make your own program and have it run via IB's API. I don't know if you can create such a conditional order directly in TWS though.
     
  9. zdreg

    zdreg

    The KISS solution would be not entering this type of orders in the first place.
     
  10. ET180

    ET180

    So simple means dedicating time to manually enter orders every morning right at the open? For swing trading, seems perfectly reasonable to enter orders after market hours for executing the following day. I define stops to exit the trade in case what I think should happen doesn't.
     
    #10     Jun 14, 2020
    murray t turtle likes this.