Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Bracket Orders open trades with open prices.

    General Discussion
    1
    1
    17
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • X
      Xerxes last edited by

      i use bracket order to put buy stop(above current price) and sell stop(below current price) orders.
      It ignores entry price i pass into it and use open price of bars.

      brackets = self.buy_bracket(limitprice=tp, price=entry, stopprice=sl)
      brackets = self.sell_bracket(limitprice=tp, price=entry, stopprice=sl)
      

      one output be like:

      1995-08-29, 166, Long at 2.72, TP: 2.975, SL: 2.55
      1995-08-30, 167, BUY EXECUTED, Price: 2.68, Cost: 16750.00, Comm 16.75
      1995-08-30, 167, Close: 2.63, Open: 2.68
      

      i tired exectype argument with its different values(bt.Order.Limit, bt.Order.Stop) but same result.

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors