Backtrader Community

    • 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/

    Indicator from Pandas DataFrame/Series

    Indicators/Strategies/Analyzers
    3
    3
    2145
    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.
    • D
      dafyddd last edited by

      For speed and ease of use purposes, I'd like to be able to create an indicator or a lines object straight from a Pandas Series object. Is this a feature of backtrader currently?

      B 1 Reply Last reply Reply Quote 0
      • RandyT
        RandyT last edited by

        @dafyddd If you haven't already, take a look at this post I made a few days ago. The transition from Pandas to the Backtrader approach was not that difficult and is one less moving part IMO.

        https://community.backtrader.com/topic/11/porting-a-pandas-dataframe-dependent-indicator

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

          @dafyddd

          As pointed out by RandyT you can port the indicator easily, imho.

          If it's a data feed there is direct support for loading a pandas.Dataframe. See:

          • https://www.backtrader.com/docu/dataautoref.html (look for PandasData)

          If you have something precalculated which is not a data feed the use case is about synchronization, because you probably want to use it as an indicator. You should then check the datetime of the data feed passed to the indicator to fetch the proper data from the dataframe.

          A more detailed use case would help in understanding what may (or may not) missing.

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