均线颜色公式-均线颜色公式指标

2023-04-22 技术指标 0次阅读 admin
均线颜色公式.jpg

关于均线颜色公式的问题,我们总结了以下几点,给你解答:

均线 颜色


均线 颜色

点击“工具”-“系统设置”-“外观”,你想修改哪条线,就在右侧栏里找指标输出1,指标输出2,等,想修改成什么颜色,就点下面的颜色块就行了。
用这个函数解决,函数解释如下
画出带状线.
用法:drawband(val1,color1,val2,color2),当val1>val2时,在val1和val2之间填充颜色color1;当val1例如:drawband(open,rgb(0,224,224),close,rgb(255,96,96)); 公式已经帮你做好了,慢慢体会就明白了 ma60:=ma(c,60); ma120:=ma(c,120); drawband(ma60,rgb(255,0,255),ma120,rgb(0,255,256));

均线颜色公式


均线颜色公式


def get_ma_color(self, ma_num):
if ma_num == 5:
return 'blue'
elif ma_num == 10:
return 'green'
elif ma_num == 20:
return 'black'
elif ma_num == 30:
return 'purple'
elif ma_num == 60:
return 'orange'
else:
return 'red'

# 获取均线名称公式
def get_ma_name(self, ma_num):
if ma_num == 5:
return 'MA5'
elif ma_num == 10:
return 'MA10'
elif ma_num == 20:
return 'MA20'
elif ma_num == 30:
return 'MA30'
elif ma_num == 60:
return 'MA60'
else:
return 'MA'

# 获取均线类型公式
def get_ma_type(self, ma_num):
if ma_num == 5:
return 'MA'
elif ma_num == 10:
return 'MA'
elif ma_num == 20:
return 'MA'
elif ma_num == 30:
return 'MA'
elif ma_num == 60:
return 'MA'
else:
return 'MA'

# 获取均线宽度公式
def get_ma_width(self, ma_num):
if ma_num == 5:
return 0.5
elif ma_num == 10:
return 0.5
elif ma_num == 20:
return 0.8
elif ma_num == 30:
return 0.8
elif ma_num == 60:
return 0.8
else:
return 0.8

# 获取均线样式公式
def get_ma_style(self, ma_num):
if ma_num == 5:
return QtCore.Qt.DashLine
elif ma_num == 10:
return QtCore.Qt.DashLine
elif ma_num == 20:
return QtCore.Qt.SolidLine
elif ma_num == 30:
return QtCore.Qt.SolidLine
elif ma_num == 60:
return QtCore.Qt.SolidLine
else:
return QtCore.Qt.SolidLine

# 获取均线描述信息
def get_ma_info(self, ma_num):
if ma_num == 5:
return [self.get_ma_name(ma_num), self.get_ma_type(ma_num), self.get_ma_color(ma_num),
self.get_ma_width(ma_num), self.get_ma_style(ma_num)]
elif ma_num == 10:
return [self.get_ma_name(ma_num), self.get_ma_type(ma_num), self.get_ma_color(ma_num),
self.get_ma_width(ma_num), self.get_ma_style(ma_num)]
elif ma_num == 20:
return [self.get_ma_name(ma_num), self.get_ma_type(ma_num), self.get_ma_color(ma_num),
self.get_ma_width(ma_num), self.get_ma_style(ma_num)]
elif ma_num == 30:
return [self.get_ma_name(ma_num), self.get_ma_type(ma_num), self.get_ma_color(ma_num),
self.get_ma_width(ma_num), self.get_ma_style(ma_num)]
elif ma_num == 60:
return [self.get_ma_name(ma_num), self.get_ma_type(ma_num), self.get_ma_color(ma_num),
self.get_ma_width(ma_num), self.get_ma_style(ma_num)]
else:
return [self.get_ma_name(ma_num), self.get_ma_type(ma_num), self.get_ma_color(ma_num),
self.get_ma_width(ma_num), self.get_ma_style(ma_num)]

# 计算均线
def calculate_ma(self, ma_num):
# 获取收盘价
close_array = np.array(self.close_array)
# 计算均线
ma_array = talib.MA(close_array, timeperiod=ma_num)
# 返回均线
return ma_array

# 计算均线
def calculate_all_ma(self):
# 计算所有均线
ma_5 = self.calculate_ma(5)
ma_10 = self.calculate_ma(10)
ma_20 = self.calculate_ma(20)
ma_30 = self.calculate_ma(30)
ma_60 = self.calculate_ma(60)
# 返回所有均线
return [ma_5, ma_10, ma_20, ma_30, ma_60]

# 获取均线数据
def get_ma_data(self):
# 计算所有均线
ma_5, ma_10, ma_20, ma_30, ma_60 = self.calculate_all_ma()
# 获取均线描述信息
ma_5_info = self.get_ma_info(5)
ma_10_info = self.get_ma_info(10)
ma_20_info = self.get_ma_info(20)
ma_30_info = self.get_ma_info(30)
ma_60_info = self.get_ma_info(60)
# 返回均线数据
return [ma_5, ma_10, ma_20, ma_30, ma_60], [ma_5_info, ma_10_info, ma_20_info, ma_30_info, ma_60_info]


# K线图类
class CandlestickItem(pg.GraphicsObject):
def __init__(self, data):
pg.GraphicsObject.__init__(self)
self.data = data # numpy record array,
self.generatePicture()

def generatePicture(self):
self.picture = QtGui.QPicture()
p = QtGui.QPainter(self.picture)
p.setPen(pg.mkPen('w'))
w = (self.data[1][0] - self.data[0][0]) / 3.
for (t, open, close, min, max) in self.data:
p.drawLine(QtCore.QPointF(t, min), QtCore.QPointF(t, max))
if open > close:
p.setBrush(pg.mkBrush('r'))
else:
p.setBrush(pg.mkBrush('g'))
p.drawRect(QtCore.QRectF(t - w, open, w * 2, close - open))
p.end()

def paint(self, p, *args):
p.drawPicture(0, 0, self.picture)

def boundingRect(self):
return QtCore.QRectF(self.picture.boundingRect())


# K线图类
class CandlestickItem2(pg.GraphicsObject):
def __init__

均线颜色公式指标


均线颜色公式指标

由于均线是系统设置的指标,虽然你可以修改颜色,但通达信会提示在下一次运行时将恢复系统的设置。所以你来自只能自己编写一个均线的公式来用。方法也很简单,只要单击公式管理器按钮调出公式管理器,新建一个公式,单击“引入指标公式”,选择名称为 MA 的均线,就自动将所有均线的公式复制出来。将公式名称改一下,加入公式描述,在每条公式加入你希望的颜色,例如红色为 COLORRED,确定就可以了。最后在主图上选择刚才建立的公式,就能运用上。这个指标,你可以随时修改颜色。

猜你感兴趣: 均线颜色公式
均线颜色公式指标是什么

均线颜色公式指标是什么

均线颜色公式指标是什么..

2023-04-20 0次阅读