Indicator from Pandas DataFrame/Series
-
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?
-
@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
-
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.
- https://www.backtrader.com/docu/dataautoref.html (look for