kernc/backtesting.py

Is there a way to enter a bracket order?

erdult opened this issue · 1 comments

Is there a way to enter a bracket order

For reference:

Bracket order is a type of market order that is placed during intraday trading only. Such orders combine a buy order with a stop-loss and target order. Bracket orders are meant to help stock market traders square off a favourable position by the end of the trading session.

So this order is path dependent (need to determine if profit taking limit or stop-loss will trigger first), with OHLC data I am not sure how it could work.

Simply calling Strategy.buy() with sl= and tp= should do it?

self.buy(size=10, limit=limit_price, sl=sl_price, tp=tp_price)

?