关于obv线内容导航:
1、obv线
def get_obv(self):
df = self.df
df['obv'] = (df['close'] - df['close'].shift(1)).cumsum()
df.loc[df['close'] < df['close'].shift(1), 'obv'] = (df['close'] - df['close'].shift(1)).cumsum() * -1
df['obv'] = df['obv'].fillna(0)
return df
# 计算macd
def get_macd(self):
df = self.df
df['ema12'] = df['close'].ewm(span=12).mean()
df['ema26'] = df['close'].ewm(span=26).mean()
df['diff'] = df['ema12'] - df['ema26']
df['dea'] = df['diff'].ewm(span=9).mean()
df['macd'] = 2 * (df['diff'] - df['dea'])
return df
# 计算kdj
def get_kdj(self):
df = self.df
low_list = df['low'].rolling(9).min()
low_list.fillna(value=df['low'].expanding().min(), inplace=True)
high_list = df['high'].rolling(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'] = rsv.ewm(com=2).mean()
df['kdj_d'] = df['kdj_k'].ewm(com=2).mean()
df['kdj_j'] = 3 * df['kdj_k'] - 2 * df['kdj_d']
return df
# 计算boll
def get_boll(self):
df = self.df
df['boll_mid'] = df['close'].rolling(20).mean()
df['boll_std'] = df['close'].rolling(20).std()
df['boll_up'] = df['boll_mid'] + 2 * df['boll_std']
df['boll_down'] = df['boll_mid'] - 2 * df['boll_std']
return df
# 计算cci
def get_cci(self):
df = self.df
df['tp'] = (df['high'] + df['low'] + df['close']) / 3
df['ma_tp'] = df['tp'].rolling(14).mean()
df['md_tp'] = df['tp'].rolling(14).std()
df['cci'] = (df['tp'] - df['ma_tp']) / (df['md_tp'] * 0.015)
return df
# 计算rsi
def get_rsi(self):
df = self.df
df['diff'] = df['close'].diff()
df['up'] = df['diff']
df['down'] = df['diff'] * -1
df.loc[df['up'] < 0, 'up'] = 0
df.loc[df['down'] < 0, 'down'] = 0
df['ma_up'] = df['up'].rolling(14).mean()
df['ma_down'] = df['down'].rolling(14).mean()
df['rs'] = df['ma_up'] / df['ma_down']
df['rsi'] = 100 - (100 / (1 + df['rs']))
return df
# 计算wr
def get_wr(self):
df = self.df
high_list = df['high'].rolling(10).max()
low_list = df['low'].rolling(10).min()
df['wr'] = 100 * (high_list - df['close']) / (high_list - low_list)
return df
# 计算dmi
def get_dmi(self):
df = self.df
df['up_move'] = df['high'] - df['high'].shift(1)
df['down_move'] = df['low'].shift(1) - df['low']
df.loc[df['up_move'] < 0, 'up_move'] = 0
df.loc[df['down_move'] < 0, 'down_move'] = 0
df['pdm'] = df['up_move']
df['mdm'] = df['down_move']
df['tr'] = df['high'] - df['low']
df['pdm_ma'] = df['pdm'].rolling(14).mean()
df['mdm_ma'] = df['mdm'].rolling(14).mean()
df['tr_ma'] = df['tr'].rolling(14).mean()
df['dip'] = df['pdm_ma'] / df['tr_ma'] * 100
df['dim'] = df['mdm_ma'] / df['tr_ma'] * 100
df['dix'] = df['dip'] - df['dim']
df['adx'] = df['dix'].ewm(span=6).mean()
df['adxr'] = df['adx'].ewm(span=6).mean()
return df
# 计算roc
def get_roc(self):
df = self.df
df['roc'] = (df['close'] - df['close'].shift(12)) / df['close'].shift(12) * 100
return df
# 计算cr
def get_cr(self):
df = self.df
df['cr_up'] = df['high'] - df['high'].shift(1)
df['cr_down'] = df['low'].shift(1) - df['low']
df.loc[df['cr_up'] < 0, 'cr_up'] = 0
df.loc[df['cr_down'] < 0, 'cr_down'] = 0
df['cr_ma_up'] = df['cr_up'].rolling(12).mean()
df['cr_ma_down'] = df['cr_down'].rolling(12).mean()
df['cr'] = df['cr_ma_up'] / df['cr_ma_down'] * 100
return df
# 计算dma
def get_dma(self):
df = self.df
df['dma'] = df['close'].rolling(12).mean() - df['close'].rolling(26).mean()
return df
# 计算vr
def get_vr(self):
df = self.df
df['vr_up'] = df['volume'][df['close'] > df['close'].shift(1)].rolling(14).sum()
df['vr_down'] = df['volume'][df['close'] < df['close'].shift(1)].rolling(14).sum()
df['vr'] = df['vr_up'] / df['vr_down'] * 100
return df
# 计算arbr
def get_arbr(self):
df = self.df
df['br'] = (df['high'] - df['close'].shift(1)) / (df['close'].shift(1)) * 100
df['ar'] = df['br'].rolling(26).sum() / 26
return df
# 计算psi
def get_psi(self):
df = self.df
df['psi'] = (df['close'] - df['close'].shift(6)) / df['close'].shift(6) * 100
return df
# 计算dpo
def get_dpo(self):
df = self.df
df['dpo'] = df['close'].shift(int(len(df) / 2 + 1)) - df['close'].rolling(20).mean()
return df
# 计算sar
def get_sar(self):
df = self.df
2、obv线是什么意思
[OBV]01=中文全名:累积能量线
02=英文全名:On Balance Volume
03=指来自标热键:OBV
04=原始参数值:无
05=指标应用法则:
06们深既误是北=1.股价一顶比一顶高,而OBV一顶比一顶低,暗示头部即将形成。
07=2.股价一底比一底低,而紧接布约群息益距固OBV一底比一底高,暗示底部即将形成。
08=3.OBV突破其N字形波动的高点次数达5次时,为短线卖点。
09=4.OBV跌破其N字形波动的低点次数达5次时,为短线买点。
10=5.OBV与ADVOL、PVT、WAD、ADL同属一组指标群,使用时应综合研判。
3、obv线怎么看
对一只股票进行综合分析,从月线到周线到日线都需要看,从月线判断个股的长期走势,周线判断中期走势,日线看短期和买卖点,所谓的看长做短,就是在长期或中期看涨的情况下,进行短期买卖,波段操作。看你的操作习惯和喜好了:
1、做中、长线的话:首先看周线,然后结合macd、boll、obv,结合30天、60天、120天均线比较好;
2、如果是中、短线:则以日线为主,同时可以看30分钟线,再结合rsi、kdj 、wr、结合5天、10天、30天均线,则灵活;
学习炒股知识,训练炒股技术,积累炒股经验,体验坐庄快感。游侠股市,智慧与谋略的虚拟股市。