问:如何使用 mplfinance 在烛台图上绘制支撑线和阻力线? [英] Q: How do I draw the support and resistance lines on a candlestick graph using mplfinance?

查看:36
本文介绍了问:如何使用 mplfinance 在烛台图上绘制支撑线和阻力线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need to draw two horizontal lines to show support and resistance.

这是我的代码:

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

我该怎么做?,我设法在图表上绘制了烛台,但无法绘制线条.

How can I do that?, I managed to draw the candlesticks on the graph but I can't draw the lines.

推荐答案

希望这件事有效.尝试找到支撑和阻力并将其添加到hlines

Hope this thing works. Try to find the support and resistance and add it to 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')

这篇关于问:如何使用 mplfinance 在烛台图上绘制支撑线和阻力线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆