gpt4 book ai didi

python - Q : How do I draw the support and resistance lines on a candlestick graph using mplfinance?

转载 作者:行者123 更新时间:2023-12-04 14:15:17 25 4
gpt4 key购买 nike

我需要画两条水平线来表示支撑和阻力。

这是我的代码:

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')

关于python - Q : How do I draw the support and resistance lines on a candlestick graph using mplfinance?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60835230/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com