我需要画两条水平线来显示支撑和阻力线。
这是我的代码。
from alpha_vantage.timeseries import TimeSeries
import mplfinance as mpf
ts = TimeSeries(key='', output_format='pandas', indexing_type='date')
data, meta_data = ts.get_daily(symbol='MSFT', outputsize='compact')
data = data.sort_values(by=['date'])
data.rename(columns={'date':'Date','1. open':'Open','2. high':'High','3. low':'Low','4. close':'Close','5. volume':'Volume'}, inplace=True)
mpf.plot(data, title='MSFT', ylabel='Price', ylabel_lower='Volume', type='candle', style='charles', volume=True, mav=(50, 200), savefig='test-mplfiance.png')
我如何能做到这一点,我设法绘制的蜡烛图,但我不能画线。
希望这件事的工作。试着找到的支撑和阻力,并将其添加到 hlines
mpf.plot(data,hlines=dict(hlines=[support,resistance],colors=['g','r'],linestyle='-.'), title='MSFT', ylabel='Price', ylabel_lower='Volume', type='candle', style='charles', volume=True, mav=(50, 200), savefig='test-mplfiance.png')