关于股票均线的颜色的问题,我们总结了以下几点,给你解答:
股票均线的颜色怎样设置
MA60:=MA(C,60);
MA120:=MA(c,120);
fillrgn(ma60,ma120,ma60>=ma120,rgb(200,0,0),ma60<ma120,rgb(0,200,0)),layer7;
STICKLINE(c>=o,c,o,8,1),colorred;
STICKLINE(c>=o,l,o,1,0),colorred;
STICKLINE(c>=o,c,h,1,0),colorred;
STICKLINE(c<o,c,o,8,0),colorffff00;
STICKLINE(c<o,h,l,1,0),colorffff00;
用fillrgn函数就可以了。
股票均线的颜色
:param stock_data:
:param ma_list:
:return:
"""
color_list = ['#FF0000', '#00FF00', '#0000FF', '#FFFF00', '#00FFFF', '#FF00FF', '#C0C0C0', '#000000']
color_dict = {}
for i in range(len(ma_list)):
color_dict[ma_list[i]] = color_list[i]
return color_dict
def get_stock_ma_data(stock_data, ma_list):
"""
获取股票均线数据
:param stock_data:
:param ma_list:
:return:
"""
ma_data = {}
for ma in ma_list:
ma_data[ma] = stock_data['close'].rolling(ma).mean()
return ma_data
def draw_stock_ma(stock_data, ma_list):
"""
绘制股票均线
:param stock_data:
:param ma_list:
:return:
"""
color_dict = get_stock_ma_color(stock_data, ma_list)
ma_data = get_stock_ma_data(stock_data, ma_list)
plt.figure(figsize=(14, 7))
plt.title('Stock MA')
plt.xlabel('Date')
plt.ylabel('Price')
plt.grid(True)
plt.plot(stock_data.index, stock_data['close'], label='Close')
for ma in ma_list:
plt.plot(stock_data.index, ma_data[ma], label=str(ma) + ' MA', color=color_dict[ma])
plt.legend()
plt.show()
if __name__ == '__main__':
stock_data = get_stock_data('000001')
ma_list = [5, 10, 20, 30, 60]
draw_stock_ma(stock_data, ma_list)
股票均线的颜色怎么分
一般我海犯船王整风宣与K线对应,收盘价高于开盘价为红色,收盘价低于开盘价为蓝色.但开盘价等于收盘价时为红色,如开盘就跌停收盘仍跌停,K线为蓝色,成交量为红色.