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

BracketOrder: stopamount and limitamount instead of stop|limitprice in the bracket order

  • I'm using CFD/FX brokers and most of them accept what is known as the bracket order in backtrader. However, they often offer to specify stopamount and limitamount, rather than stopprice and limitprice. E.g. instead of specifying a buy bracket of 2400, stopprice 2350, limitprice 2500. One can specify buy bracket 2400, -50, +100. The advantage of using amounts instead of the price, is that when the buy order is executed at 2400.1 (due to slippage / spread) the oco that are opened are adjusted accordingly and become 2350.1 and 2500.1 respectively.

    Would it be possible to implement stopamount / limitamount for the bracket orders, and make sure that the bracket sides are adjusted +/- relative to the (first or average weighted) executed price of the initial order?

Log in to reply