For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

both buy and sell orders executed on same bar

  • Hi Guys,
    I like some advice from more experienced guys. Trying to see how to avoid this.

    Testing a breakout strategy.
    at min 10, I place a stop order to buy at 2.00, place a stoploss at A
    at min 15 I place a stop order to sell at 1.50, place a stoploss at B
    at min 17, both stop orders got triggered on the same bar (when the price movement is this big) and they close out the position.

    Earlier, I experienced both orders triggered, but on different bar. I am able to
    add code in if order.status in [order completed], if I have gone into 1 position, I just cancel the other pending. But happening on the same bar left me scratching my head.

    Any ideas or suggestions to workaround this?

  • buy orders - are they both executed or only one of them executed?

Log in to reply