均线一般设置-均线一般设置哪几个周期

2023-04-19 11:01:05 技术指标 0次阅读 投稿:admin
均线一般设置.jpg

关于均线一般设置的问题,我们总结了以下几点,给你解答:

均线一般设置几条


均线一般设置几条

可以   右键点其中一根均线   选择修改指标公式   在公式语法中添加到10条就可以   如何再默认参数里修改你需要的均线


有必要设置那么多吗?那么多线同时显示,图形不是很烦乱吗?

均线一般设置


均线一般设置

为20
# 将数据放入到talib中计算
ma20 = talib.SMA(close, timeperiod=20)
# 计算收盘价与20日均线的差
diff = close - ma20
# 将差值放入talib中计算
dea = talib.EMA(diff, timeperiod=9)
# 计算macd
macd = 2 * (diff - dea)
# 将计算结果放入DataFrame中
df['ma20'] = ma20
df['diff'] = diff
df['dea'] = dea
df['macd'] = macd
# 返回结果
return df

# 计算KDJ指标
def KDJ(df):
# 计算KDJ指标
low_list = df['low'].rolling(window=9, min_periods=9).min()
low_list.fillna(value=df['low'].expanding().min(), inplace=True)
high_list = df['high'].rolling(window=9, min_periods=9).max()
high_list.fillna(value=df['high'].expanding().max(), inplace=True)
rsv = (df['close'] - low_list) / (high_list - low_list) * 100
df['KDJ_K'] = pd.DataFrame(talib.EMA(rsv, timeperiod=3), index=df.index)
df['KDJ_D'] = pd.DataFrame(talib.EMA(df['KDJ_K'], timeperiod=3), index=df.index)
df['KDJ_J'] = 3 * df['KDJ_K'] - 2 * df['KDJ_D']
# 返回结果
return df

# 计算RSI指标
def RSI(df):
# 计算RSI指标
df['RSI_6'] = talib.RSI(df['close'], timeperiod=6)
df['RSI_12'] = talib.RSI(df['close'], timeperiod=12)
df['RSI_24'] = talib.RSI(df['close'], timeperiod=24)
# 返回结果
return df

# 计算WR指标
def WR(df):
# 计算WR指标
df['WR_10'] = talib.WILLR(df['high'], df['low'], df['close'], timeperiod=10)
df['WR_6'] = talib.WILLR(df['high'], df['low'], df['close'], timeperiod=6)
# 返回结果
return df

# 计算CCI指标
def CCI(df):
# 计算CCI指标
df['CCI_14'] = talib.CCI(df['high'], df['low'], df['close'], timeperiod=14)
df['CCI_20'] = talib.CCI(df['high'], df['low'], df['close'], timeperiod=20)
# 返回结果
return df

# 计算BOLL指标
def BOLL(df):
# 计算BOLL指标
df['BOLL_UP'], df['BOLL_MB'], df['BOLL_DN'] = talib.BBANDS(df['close'], timeperiod=20, nbdevup=2, nbdevdn=2, matype=0)
# 返回结果
return df

# 计算ATR指标
def ATR(df):
# 计算ATR指标
df['ATR_14'] = talib.ATR(df['high'], df['low'], df['close'], timeperiod=14)
df['ATR_20'] = talib.ATR(df['high'], df['low'], df['close'], timeperiod=20)
# 返回结果
return df

# 计算均线指标
def MA(df):
# 计算MA指标
df['MA_5'] = talib.MA(df['close'], timeperiod=5)
df['MA_10'] = talib.MA(df['close'], timeperiod=10)
df['MA_20'] = talib.MA(df['close'], timeperiod=20)
df['MA_30'] = talib.MA(df['close'], timeperiod=30)
df['MA_60'] = talib.MA(df['close'], timeperiod=60)
# 返回结果
return df

# 计算动量类指标
def MOMENTUM(df):
# 计算动量类指标
df['MOM_10'] = talib.MOM(df['close'], timeperiod=10)
df['ROC_10'] = talib.ROC(df['close'], timeperiod=10)
df['RSI_6'] = talib.RSI(df['close'], timeperiod=6)
df['RSI_12'] = talib.RSI(df['close'], timeperiod=12)
df['RSI_24'] = talib.RSI(df['close'], timeperiod=24)
df['BIAS_6'] = (df['close'] - df['MA_6']) / df['MA_6'] * 100
df['BIAS_12'] = (df['close'] - df['MA_12']) / df['MA_12'] * 100
df['BIAS_24'] = (df['close'] - df['MA_24']) / df['MA_24'] * 100
# 返回结果
return df

# 计算波动类指标
def VOLATILITY(df):
# 计算波动类指标
df['ATR_14'] = talib.ATR(df['high'], df['low'], df['close'], timeperiod=14)
df['ATR_20'] = talib.ATR(df['high'], df['low'], df['close'], timeperiod=20)
df['ATR_60'] = talib.ATR(df['high'], df['low'], df['close'], timeperiod=60)
df['STD_20'] = df['close'].rolling(window=20, min_periods=20).std()
# 返回结果
return df

# 计算趋势类指标
def TREND(df):
# 计算趋势类指标
df['MA_5'] = talib.MA(df['close'], timeperiod=5)
df['MA_10'] = talib.MA(df['close'], timeperiod=10)
df['MA_20'] = talib.MA(df['close'], timeperiod=20)
df['MA_30'] = talib.MA(df['close'], timeperiod=30)
df['MA_60'] = talib.MA(df['close'], timeperiod=60)
df['EMA_12'] = talib.EMA(df['close'], timeperiod=12)
df['EMA_26'] =

均线一般设置哪几个周期


均线一般设置哪几个周期

一般用周期参数.
日线:20;一个月20天
四小时:6,一天6*4小时.


声明:稳得一批是理财投资基础知识平台! 并不指导专业性投资! 投资有风险,入市需谨慎!