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/

    trade historyon

    General Code/Help
    3
    4
    1738
    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.
    • T
      ThatBlokeDave last edited by ThatBlokeDave

      Hello,
      In the documentation for a trade. There is a keyword argument to set historyon for a trade. Where / when should this be set to activate history?

      https://www.backtrader.com/docu/trade.html?highlight=historyon#reference-trade

      A search for historyon only directs me to the one page. Perhaps when justopened is called?

      Thanks!

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

        A trade can be the sum of several orders. For example:

        • 5 orders that add each 10 items
        • 2 orders reduce 10 items each
        • 3 new orders add 15 items
        • A final order reduces the trade down to 0 from 75 items

        With historyon, each order is recorded inside the Trade object which is in charge of tracking that trade.

        When? When you want and you need it.

        You activate it in cerebro with tradehistory. See Docs - Cerebro

        T 1 Reply Last reply Reply Quote 0
        • T
          ThatBlokeDave @backtrader last edited by

          @backtrader

          Great thanks! I didn't spot it in the cerebro docs since it has a different keyword name.

          My "when" question was more in relation to when in the life of a script / backtest. You answered that thanks. I should set it when setting up cerebro or within the strategy using the set_tradehistory method.

          Appreciate the info!

          1 Reply Last reply Reply Quote 0
          • Richard O'Regan
            Richard O'Regan last edited by

            Great thanks, I was wondering the exact same thing!

            You can take the man out of the army, but you can't take the army out of the man.

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