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/

    Cash management and analyzers

    Indicators/Strategies/Analyzers
    2
    3
    142
    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.
    • H
      hoflz5 last edited by

      I try so simulate some basic cash management, by making calling buy() with different amount on different conditions buy(amount = <amount>).
      While debugging I can see that buy is indeed called with the correct amount.
      When I run the analyzer though:

      result = cerebro.run()
      result[0].analyzers.ta.get_analysis()

      I get the exact same results as if I always called buy() without any amount. Any thoughts on this?

      vladisld 1 Reply Last reply Reply Quote 1
      • vladisld
        vladisld @hoflz5 last edited by

        @hoflz5 try to use 'size' parameter instead of 'amount'. Docs here:https://www.backtrader.com/docu/strategy/

        H 1 Reply Last reply Reply Quote 3
        • H
          hoflz5 @vladisld last edited by

          @vladisld Thanks for the quick response! That solved my issue.

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