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/

    Problem with Backtrader?

    General Code/Help
    3
    4
    86
    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.
    • F
      FoxBearBear last edited by

      By the end of the backtest it starts selling without buying and the profit goes to the moon.

      Figure_1.png Figure_0.png

      F 1 Reply Last reply Reply Quote -1
      • F
        FoxBearBear @FoxBearBear last edited by

        Some of the orders... see how the profit is wrongly calculated.

        2021-02-06, BUY CREATE, 0.45
        2021-02-06, BUY EXECUTED, Price: 0.45, Cost: 200.40, Comm 0.00
        2021-02-06, SELL CREATE, 0.45
        2021-02-06, SELL EXECUTED, Price: 0.45, Cost: 200.40, Comm 0.00
        2021-02-06, OPERATION PROFIT, GROSS 1.52, NET 1.52

        vladisld 1 Reply Last reply Reply Quote 0
        • vladisld
          vladisld @FoxBearBear last edited by

          @foxbearbear it would help if you could share your code.

          1 Reply Last reply Reply Quote 1
          • A
            ab_trader last edited by

            Looks like your strategy opens a lot of short positions at the end of the backtests. Highly likely it is not a problem of bt, but bug in the strategy script.

            • If my answer helped, hit reputation up arrow at lower right corner of the post.
            • Python Debugging With Pdb
            • New to python and bt - check this out
            1 Reply Last reply Reply Quote 1
            • 1 / 1
            • First post
              Last post
            Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors