For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
How to write an indicator equivalent to pandas.expanding().mean()?

I've read the following source code:
https://github.com/mementum/backtrader/blob/master/backtrader/indicators/basicops.py
It seems every indicator has a
period
.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
next()
: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/cryptonotebooks/blob/master/backtest/backtraderEWMAC.ipynb