Closed ziyedbe closed 1 year ago
even i am facing this issue while plotting MACD, i am unable to resolve error
i have written the code in this
file.py
from autotrader import autoplot, indicators, autodata, AutoTrader, AutoData import pandas as pd import datetime import yfinance as yf import finta as ta import datetime as dt
data_yf = yf.download(tickers='AAPL', start=pd.date_range( end=datetime.datetime.today(), periods=360)[0], interval='1d')
rsi = ta.TA.RSI(data_yf) obv = ta.TA.OBV(data_yf) mfi = ta.TA.MFI(data_yf) cmf = ta.TA.CHAIKIN(data_yf) ema = ta.TA.EMA(data_yf)
macd = ta.TA.MACD(data_yf) macd_co = crossover(macd.MACD, macd.SIGNAL) macd_co_val = cross_values(macd.MACD, macd.SIGNAL, macd_co)
rsi_divergence = indicators.autodetect_divergence( data_yf, rsi, tolerance=15, method=0)
obv_divergence = indicators.autodetect_divergence( data_yf, obv, tolerance=10, method=1)
indicator_dict = {'RSI (14)': {'type': 'RSI', 'data': rsi}, 'obv': {'type': 'below', 'data': obv}, 'mfi': {'type': 'below', 'data': mfi}, 'cmf': {'type': 'below', 'data': cmf},
'diveregence_Bull': {'type': 'below', 'data': rsi_divergence['regularBull']},
'diveregence_bear': {'type': 'below', 'data': rsi_divergence['regularBear']},
'MACD': {'type': 'MACD',
'macd': macd.MACD,
'signal': macd.SIGNAL,
'histogram': macd.MACD-macd.SIGNAL,
'crossvals': macd_co_val
},
}
ap = autoplot.AutoPlot(data=data_yf) ap.configure(max_indis_below=10, max_indis_over=10) ap.plot(instrument='AAPL', indicators=indicator_dict),
Describe the bug When I run the backtest on multiple pairs, i get the following error
To Reproduce Steps to reproduce the behavior: runfile.py
ema_crossover.yaml
Expected behavior Create 3 graphs one for each pair in the watchlist
Version of AutoTrader being used 0.12.0