均线数值设定-均线数值设定多少合适

2023-04-21 技术指标 0次阅读 admin
均线数值设定.jpg

关于均线数值设定的问题,我们总结了以下几点,给你解答:

均线数值设定多少合适


均线数值设定多少合适

做短线一般以15分钟30分钟60分钟和日K线作参考
而长线操作是以周、月、年K线作为参考

均线周期一般软件是初始设置为5 10 20 60日均线
但是,很多操盘手都是使用3、6、18、60、120、250
后者更贴近市场更能体现市场变化

建议修改为后者

均线数值设定


均线数值设定


# 均线参数
ma1 = 10
ma2 = 20
ma3 = 30
ma4 = 60
# 均线名称
ma1_name = 'ma_' + str(ma1)
ma2_name = 'ma_' + str(ma2)
ma3_name = 'ma_' + str(ma3)
ma4_name = 'ma_' + str(ma4)
# 计算均线
data[ma1_name] = data['close'].rolling(ma1).mean()
data[ma2_name] = data['close'].rolling(ma2).mean()
data[ma3_name] = data['close'].rolling(ma3).mean()
data[ma4_name] = data['close'].rolling(ma4).mean()
# 计算均线收益
data['ma_ret_' + str(ma1)] = data['close'] / data[ma1_name] - 1
data['ma_ret_' + str(ma2)] = data['close'] / data[ma2_name] - 1
data['ma_ret_' + str(ma3)] = data['close'] / data[ma3_name] - 1
data['ma_ret_' + str(ma4)] = data['close'] / data[ma4_name] - 1
# 计算均线收益率
data['ma_ret_' + str(ma1) + '_rate'] = data['ma_ret_' + str(ma1)].pct_change()
data['ma_ret_' + str(ma2) + '_rate'] = data['ma_ret_' + str(ma2)].pct_change()
data['ma_ret_' + str(ma3) + '_rate'] = data['ma_ret_' + str(ma3)].pct_change()
data['ma_ret_' + str(ma4) + '_rate'] = data['ma_ret_' + str(ma4)].pct_change()
# 计算均线收益率差
data['ma_ret_' + str(ma1) + '_' + str(ma2) + '_diff'] = data['ma_ret_' + str(ma1) + '_rate'] - data['ma_ret_' + str(ma2) + '_rate']
data['ma_ret_' + str(ma2) + '_' + str(ma3) + '_diff'] = data['ma_ret_' + str(ma2) + '_rate'] - data['ma_ret_' + str(ma3) + '_rate']
data['ma_ret_' + str(ma3) + '_' + str(ma4) + '_diff'] = data['ma_ret_' + str(ma3) + '_rate'] - data['ma_ret_' + str(ma4) + '_rate']
# 计算均线收益率差比
data['ma_ret_' + str(ma1) + '_' + str(ma2) + '_diff_rate'] = data['ma_ret_' + str(ma1) + '_' + str(ma2) + '_diff'] / data['ma_ret_' + str(ma2) + '_rate']
data['ma_ret_' + str(ma2) + '_' + str(ma3) + '_diff_rate'] = data['ma_ret_' + str(ma2) + '_' + str(ma3) + '_diff'] / data['ma_ret_' + str(ma3) + '_rate']
data['ma_ret_' + str(ma3) + '_' + str(ma4) + '_diff_rate'] = data['ma_ret_' + str(ma3) + '_' + str(ma4) + '_diff'] / data['ma_ret_' + str(ma4) + '_rate']
# 计算均线收益率差比涨跌
data['ma_ret_' + str(ma1) + '_' + str(ma2) + '_diff_rate_up'] = np.where(data['ma_ret_' + str(ma1) + '_' + str(ma2) + '_diff_rate'] > 0, 1, 0)
data['ma_ret_' + str(ma2) + '_' + str(ma3) + '_diff_rate_up'] = np.where(data['ma_ret_' + str(ma2) + '_' + str(ma3) + '_diff_rate'] > 0, 1, 0)
data['ma_ret_' + str(ma3) + '_' + str(ma4) + '_diff_rate_up'] = np.where(data['ma_ret_' + str(ma3) + '_' + str(ma4) + '_diff_rate'] > 0, 1, 0)
# 计算均线收益率差比涨跌幅
data['ma_ret_' + str(ma1) + '_' + str(ma2) + '_diff_rate_chg'] = data['ma_ret_' + str(ma1) + '_' + str(ma2) + '_diff_rate'].diff()
data['ma_ret_' + str(ma2) + '_' + str(ma3) + '_diff_rate_chg'] = data['ma_ret_' + str(ma2) + '_' + str(ma3) + '_diff_rate'].diff()
data['ma_ret_' + str(ma3) + '_' + str(ma4) + '_diff_rate_chg'] = data['ma_ret_' + str(ma3) + '_' + str(ma4) + '_diff_rate'].diff()
# 计算均线收益率差比涨跌幅涨跌
data['ma_ret_' + str(ma1) + '_' + str(ma2) + '_diff_rate_chg_up'] = np.where(data['ma_ret_' + str(ma1) + '_' + str(ma2) + '_diff_rate_chg'] > 0, 1, 0)
data['ma_ret_' + str(ma2) + '_' + str(ma3) + '_diff_rate_chg_up'] = np.where(data['ma_ret_' + str(ma2) + '_' + str(ma3) + '_diff_rate_chg'] > 0, 1, 0)
data['ma_ret_' + str(ma3) + '_' + str(ma4) + '_diff_rate_chg_up'] = np.where(data['ma_ret_' + str(ma3) + '_' + str(ma4) + '_diff_rate_chg'] > 0, 1, 0)
# 计算均线收益率差比涨跌幅涨跌幅
data['ma_ret_' + str(ma1) + '_' + str(ma2) + '_diff_rate_chg_chg'] = data['ma_ret_' + str(ma1) + '_' + str(ma2) + '_diff_rate_chg'].diff()
data['ma_ret_' + str(ma2) + '_' + str(ma3) + '_diff_rate_chg_chg'] = data['ma_ret_' + str(ma2) + '_' + str(ma3) + '_diff_rate_chg'].diff()
data['ma_ret_' + str(ma3) + '_' + str(ma

均线数值设定什么意思


均线数值设定什么意思

在月K线图中:MA5代表5月均线;MA10代表10月均线......其余类推.
这些均线可自行设置.

猜你感兴趣: 均线数值设定