I'm using mplfinance and I want the moving average in this code to represent a specific attribute which is open price.
AAPL1 =pd.read_csv('./HMW1/AAPL.csv',index_col=0,parse_dates=True)
AAPL1.index.name = 'Date'
AAPL1 = AAPL1.loc['2020-03-15' : '2020-06-14']
mpf.plot(AAPL1 ,type='candle',mav=(10,20))
Presently mplfinance does not support
mav
for anything other than "Close". (However this would be a relatively easy enhancement if you are interested in contributing to the project; I would be happy to guide you).In the meantime, if you want a moving average of something other than "Close" you will have to calculate it yourself, and use
mpf.make_addplot()
to plot it.That should do it.
See also this link for more information about using mplfinance's
make_addplot()
api.(Or if that link doesn't render, then try this one).