ma均线-ma均线什么意思

2023-04-18 16:45:14 技术指标 0次阅读 投稿:admin
ma均线.jpg

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

ma均线指标详解图解


ma均线指标详解图解

MA(C,30) 或 MA(CLOSE,30) ----收盘价的30日简单移动平均
MA(H,30) 或 MA(HIGH,30) ----最高价的30日简单移动平均
MA(L,30) 或 MA(LOW,30) ----最低价的30日简单移动平均
MA(O,30) 或 MA(OPEN,30) ----开盘价的30日简单移动平均
炒股这个事在中国就是笑话
你要努力十年才行
在中国技术型炒股不如信息型好

再看看别人怎么说的。

ma均线


ma均线


:param df:
:param n:
:return:
'''
MA = pd.Series(pd.rolling_mean(df['close'], n), name='MA_' + str(n))
df = df.join(MA)
return df

def get_EMA(df, n):
'''
获取EMA均线
:param df:
:param n:
:return:
'''
EMA = pd.Series(pd.ewma(df['close'], span=n, min_periods=n - 1), name='EMA_' + str(n))
df = df.join(EMA)
return df

def get_MACD(df, n_fast, n_slow):
'''
获取MACD
:param df:
:param n_fast:
:param n_slow:
:return:
'''
EMAfast = pd.Series(pd.ewma(df['close'], span=n_fast, min_periods=n_slow - 1))
EMAslow = pd.Series(pd.ewma(df['close'], span=n_slow, min_periods=n_slow - 1))
MACD = pd.Series(EMAfast - EMAslow, name='MACD_' + str(n_fast) + '_' + str(n_slow))
MACDsign = pd.Series(pd.ewma(MACD, span=9, min_periods=8), name='MACDsign_' + str(n_fast) + '_' + str(n_slow))
MACDdiff = pd.Series(MACD - MACDsign, name='MACDdiff_' + str(n_fast) + '_' + str(n_slow))
df = df.join(MACD)
df = df.join(MACDsign)
df = df.join(MACDdiff)
return df

def get_KDJ(df, n):
'''
获取KDJ
:param df:
:param n:
:return:
'''
low_list = pd.rolling_min(df['low'], n)
low_list.fillna(value=pd.expanding_min(df['low']), inplace=True)
high_list = pd.rolling_max(df['high'], n)
high_list.fillna(value=pd.expanding_max(df['high']), inplace=True)
rsv = (df['close'] - low_list) / (high_list - low_list) * 100
K = pd.Series(pd.ewma(rsv, span=9, min_periods=8), name='K')
D = pd.Series(pd.ewma(K, span=9, min_periods=8), name='D')
J = pd.Series(3 * K - 2 * D, name='J')
df = df.join(K)
df = df.join(D)
df = df.join(J)
return df

def get_BOLL(df, n):
'''
获取BOLL
:param df:
:param n:
:return:
'''
MA = pd.Series(pd.rolling_mean(df['close'], n))
MSD = pd.Series(pd.rolling_std(df['close'], n))
b1 = 4 * MSD / MA
BOLL = pd.Series(MA + b1, name='BOLL_' + str(n))
df = df.join(BOLL)
return df

def get_ROC(df, n):
'''
获取ROC
:param df:
:param n:
:return:
'''
M = df['close'].diff(n - 1)
N = df['close'].shift(n - 1)
ROC = pd.Series(M / N, name='ROC_' + str(n))
df = df.join(ROC)
return df

def get_MTM(df, n):
'''
获取MTM
:param df:
:param n:
:return:
'''
MTM = pd.Series(df['close'].diff(n), name='MTM_' + str(n))
df = df.join(MTM)
return df

def get_ATR(df, n):
'''
获取ATR
:param df:
:param n:
:return:
'''
i = 0
TR_list = [0]
while i < len(df) - 1:
TR = max(df.get_value(i + 1, 'high'), df.get_value(i, 'close')) - min(df.get_value(i + 1, 'low'), df.get_value(i, 'close'))
TR_list.append(TR)
i = i + 1
TR_s = pd.Series(TR_list)
ATR = pd.Series(pd.ewma(TR_s, span=n, min_periods=n), name='ATR_' + str(n))
df = df.join(ATR)
return df

def get_DMI(df, n):
'''
获取DMI
:param df:
:param n:
:return:
'''
i = 0
UpI = []
DoI = []
while i + 1 <= len(df) - 1:
UpMove = df.get_value(i + 1, 'high') - df.get_value(i, 'high')
DoMove = df.get_value(i, 'low') - df.get_value(i + 1, 'low')
if UpMove > DoMove and UpMove > 0:
UpD = UpMove
else:
UpD = 0
UpI.append(UpD)
if DoMove > UpMove and DoMove > 0:
DoD = DoMove
else:
DoD = 0
DoI.append(DoD)
i = i + 1
i = 0
TR_list = [0]
while i < len(df) - 1:
TR = max(df.get_value(i + 1, 'high'), df.get_value(i, 'close')) - min(df.get_value(i + 1, 'low'), df.get_value(i, 'close'))
TR_list.append(TR)
i = i + 1
TR_s = pd.Series(TR_list)
ATR = pd.Series(pd.ewma(TR_s, span=n, min_periods=n))
UpI = pd.Series(UpI)
DoI = pd.Series(DoI)
PosDI = pd.Series(pd.ewma(UpI, span=n, min_periods=n - 1) / ATR)
NegDI = pd.Series(pd.ewma(DoI, span=n, min_periods=n - 1) / ATR)
ADX = pd.Series(pd.ewma(abs(PosDI - NegDI) / (PosDI + NegDI), span=n, min_periods=n - 1), name='ADX_' + str(n))
df = df.join(ADX)
return df

def get_BIAS(df, n):
'''
获取BIAS
:param df:
:param n:
:return:
'''
MA = pd.Series(pd.rolling_mean(df['close'], n))
BIAS = pd.Series((df['close'] - MA) / MA, name='BIAS_' + str(n))
df = df.join(BIAS)
return df

def get_CCI(df, n):
'''
获取CCI
:param df:
:param n:
:return:
'''
PP

ma均线什么意思


ma均线什么意思

ma60均线代表时间周期不同,如日线图,代表身晶或括血示希且60日线,在周线图,代表60周线,在月线图,则代表60月线等。



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