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/

    PnL for every data

    Indicators/Strategies/Analyzers
    multiple data pnl
    2
    3
    183
    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.
    • MrKalindro
      MrKalindro last edited by

      Hello guys,

      I was wondering what could be the best approach to track PnL (and maybe drawdown, that would be amazing) for every data in scenario where I backtest a set of datas (250) as a form of portfolio with ranking? I would love to evaluate which assets brought the most profit/DD, not only the overall portfolio return. I can imagine that instead of running a backtest for a set of data, I could split the logic to run 250 single backtest, but it's not the best approach. I was also thinking about appending a dict on every next() with some trade_notify, is there some more sophisticated way to approach thsi topic?

      run-out 1 Reply Last reply Reply Quote 0
      • run-out
        run-out @MrKalindro last edited by

        @mrkalindro Can't you just evaluate a list of completed trades?

        RunBacktest.com

        MrKalindro 1 Reply Last reply Reply Quote 2
        • MrKalindro
          MrKalindro @run-out last edited by

          @run-out You are right, I thought there may be some ready option for it, but just simple:

              def __init__(self):
                      self.coins_indicators[d]["pnl"] = 0
          
              def notify_trade(self, trade):
                  if trade.isclosed:
                      self.coins_indicators[trade.data]["pnl"] += trade.pnl
          

          Get's the job done, thank you!

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