How to write an indicator equivalent to pandas.expanding().mean()?
I've read the following source code:
It seems every indicator has a
I found no way to implement an indicator with the following logic:
import pandas as pd data = pd.Series([1.0, 2.0, 3.0, 4.0]) indicators = data.expanding(2).mean()
Any ideas? Thanks
I assume that equivalent will be this formula in the
value = sum(self.data.close.get(size=len(self.data)))/len(self.data)
@ab_trader It works, thanks!
I implemented the EWMAC strategy from the book "Systematic Trading" by Robert Carver, Jupyter notebook: https://github.com/soulmachine/crypto-notebooks/blob/master/backtest/backtrader-EWMAC.ipynb