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/

    Difference between Backtrader and TradingView?

    General Discussion
    3
    4
    840
    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.
    • A
      alexfr last edited by

      Hello,

      Thank you for the amazing work on this very useful tool.
      I'm discovering algo trading and backtesting methods.

      I have differences between Backtrader and TradingView using the same strategy that I would like to understand.

      But the trades that both platforms are doing are totally different.

      See what I have on Backtrader (only 7 trades on the timeframe):
      02fe5e5c-9907-4b92-8915-149a0853c73f-image.png

      And see what I have on TradingView (many more trades are being done!):
      04c51398-8454-4c61-9b12-bbbf88aec74e-image.png

      I do have the same value on both platforms for these parameters:

      • data = bitcoin/usd
      • 1 bar per day
      • MACD strategy: short=12, long=21, macd=17

      What other parameters could explain this difference? I must miss something.

      Thanks

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

        @alexfr said in Difference between Backtrader and TradingView?:

        What other parameters could explain this difference?

        Based on the amount of data provided (couple pictures) the following can be said for sure: you have a mistake(s) somewhere in one of your scripts. Or you have mistakes in both of the scripts, therefore all results shown are wrong.

        I must miss something.

        You miss the main thing - the author of the code debugs the code. Print all the inputs and outputs, go bar by bar, do spot check by hands, compare results, find differences, get back to the script, identify what is the reason for differences, make corrections if necessary.

        Good luck!

        • 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
        • B
          backtrader administrators last edited by

          Adding to what @ab_trader said, there is something clear by simply looking at the charts: IT' NOT THE SAME DATA. It looks similar, but it isn't the same.

          If that doesn't suffice to let you understand where there difference lies ... well people can read code and data, but people cannot read charts (people can spot patterns in the chart to understand things like that it is not the same data)

          1 Reply Last reply Reply Quote 0
          • A
            alexfr last edited by

            Thanks for your replies!
            I was investigating more and found an issue with my MACD strategy implementation on backtrader. By correcting it, I get almost the exact same trades as on TradingView.
            That's a good sign for me that I'm not doing bullshit with backtrader, yay.

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