Navigation

    Backtrader Community

    • Register
    • 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 Order - "valid" parameter

    General Code/Help
    3
    3
    384
    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.
    • Z
      Z03 last edited by

      Hello, I'm trying to simulate a buy stop and sell stop trade, I am currently opening a buy bracket order where the main orders exectype is a Stop Order at a price above the current market price, everything is working as expected until I set the "valid" parameter to expire the bracket order after 30 minutes if the price isn't reached, the problem I'm seeing is that the main order gets expired after 30 minutes even after the main orders stop price is hit, is this the intended functionality? My goal is to issue a buy stop order that has an expiry time but if the price is reached I don't want to expire the tp/sl orders that were set during the creation of the bracket order.. any ideas?

      1 Reply Last reply Reply Quote 0
      • Robin Dhillon
        Robin Dhillon last edited by

        Issue the orders manually, gives more control over the orders sent. Try using the parent-child orders. It would be better if you could post a snippet of the code, for further analysis. Try reading the bracket order documention for manually issuing them.

        1 Reply Last reply Reply Quote 0
        • B
          backtrader administrators last edited by backtrader

          The buy_bracket/sell_bracket methods contain the parameters limitargs and stopargs, which are dictionaries intended to supply specific value for the corresponding orders. You can specify valid for each, both or none of them. And you can use kwargs to affect all of them.

          See: Docs - Strategy

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