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/

    allow cash to get negative

    Indicators/Strategies/Analyzers
    2
    3
    943
    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.
    • B
      Benoît Zuber last edited by

      Is it possible to let broker trade even if there is not enough cash? Say, get_cash() reports $1000. My strategy says it should buy some asset for a value of $2000. Backtrader broker normal behaviour will be not to execute the order since the trade would cost more cash than available.
      I would like to let the trade happen and allow cash to get negative (equivalent to having borrowed cash). Is this possible? Or should I determine that I have not enough cash, and add a certain amount of cash to my account?
      I'd prefer the first option, since I don't want my account value to increase when I borrow. I'd rather like to keep track of my dept in account value. My position sizing indeed depends on account value and I don't want the strategy to start oversizing positions because it sees fresh cash coming and does not understand that this is borrowed money and that the net account value does not increase when money is borrowed.

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

        Use leverage. The broker won't let you have a negative position in cash.

        B 1 Reply Last reply Reply Quote 0
        • B
          Benoît Zuber @backtrader last edited by

          @backtrader Thanks! Yes I am exploring this route. I may come up with a few questions later.
          Cheers

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
          $(document).ready(function () { app.coldLoad(); }); }