关于股票的obv内容导航:
1、股票的obv
:param stock_data:
:return:
"""
obv = [0]
for i in range(1, len(stock_data)):
if stock_data.iloc[i]['close'] > stock_data.iloc[i - 1]['close']:
obv.append(obv[i - 1] + stock_data.iloc[i]['volume'])
elif stock_data.iloc[i]['close'] == stock_data.iloc[i - 1]['close']:
obv.append(obv[i - 1])
else:
obv.append(obv[i - 1] - stock_data.iloc[i]['volume'])
return obv
def get_macd(stock_data):
"""
计算股票的macd
:param stock_data:
:return:
"""
ema12 = get_ema(stock_data, 12)
ema26 = get_ema(stock_data, 26)
dif = [ema12[i] - ema26[i] for i in range(len(ema12))]
dea = get_ema(dif, 9)
macd = [2 * (dif[i] - dea[i]) for i in range(len(dif))]
return dif, dea, macd
def get_kdj(stock_data):
"""
计算股票的kdj
:param stock_data:
:return:
"""
kdj_k = []
kdj_d = []
for i in range(len(stock_data)):
if i > 8:
low_list = stock_data.iloc[i - 9:i + 1]['low'].tolist()
high_list = stock_data.iloc[i - 9:i + 1]['high'].tolist()
rsv = (stock_data.iloc[i]['close'] - min(low_list)) / (max(high_list) - min(low_list)) * 100
if i == 9:
kdj_k.append(rsv)
kdj_d.append(rsv)
else:
kdj_k.append(2 / 3 * kdj_k[i - 10] + 1 / 3 * rsv)
kdj_d.append(2 / 3 * kdj_d[i - 10] + 1 / 3 * kdj_k[i - 1])
else:
kdj_k.append(50)
kdj_d.append(50)
j = [3 * kdj_k[i] - 2 * kdj_d[i] for i in range(len(kdj_k))]
return kdj_k, kdj_d, j
def get_boll(stock_data):
"""
计算股票的布林线
:param stock_data:
:return:
"""
boll_mid = get_ma(stock_data, 20)
boll_std = []
for i in range(len(stock_data)):
if i > 19:
boll_std.append(np.std(stock_data.iloc[i - 19:i + 1]['close'].tolist()))
else:
boll_std.append(np.std(stock_data.iloc[:i + 1]['close'].tolist()))
boll_up = [boll_mid[i] + 2 * boll_std[i] for i in range(len(boll_mid))]
boll_down = [boll_mid[i] - 2 * boll_std[i] for i in range(len(boll_mid))]
return boll_mid, boll_up, boll_down
def get_rsi(stock_data):
"""
计算股票的rsi
:param stock_data:
:return:
"""
rsi = []
for i in range(len(stock_data)):
if i == 0:
rsi.append(0)
else:
up_sum = 0
down_sum = 0
for j in range(i):
if stock_data.iloc[j + 1]['close'] > stock_data.iloc[j]['close']:
up_sum += stock_data.iloc[j + 1]['close'] - stock_data.iloc[j]['close']
else:
down_sum += stock_data.iloc[j]['close'] - stock_data.iloc[j + 1]['close']
if down_sum == 0:
rsi.append(100)
else:
rsi.append(up_sum / down_sum * 100)
return rsi
def get_wr(stock_data):
"""
计算股票的wr
:param stock_data:
:return:
"""
wr = []
for i in range(len(stock_data)):
if i > 13:
high_list = stock_data.iloc[i - 13:i + 1]['high'].tolist()
low_list = stock_data.iloc[i - 13:i + 1]['low'].tolist()
wr.append((max(high_list) - stock_data.iloc[i]['close']) / (max(high_list) - min(low_list)) * 100)
else:
wr.append(0)
return wr
def get_cci(stock_data):
"""
计算股票的cci
:param stock_data:
:return:
"""
cci = []
for i in range(len(stock_data)):
if i > 13:
tp_list = [(stock_data.iloc[j]['high'] + stock_data.iloc[j]['low'] + stock_data.iloc[j]['close']) / 3 for j in
range(i - 13, i + 1)]
ma = np.mean(tp_list)
md = np.std(tp_list)
cci.append((stock_data.iloc[i]['close'] - ma) / (md * 0.015))
else:
cci.append(0)
return cci
def get_all_index(stock_data):
"""
计算股票的所有技术指标
:param stock_data:
:return:
"""
ma5 = get_ma(stock_data, 5)
ma10 = get_ma(stock_data, 10)
ma20 = get_ma(stock_data, 20)
ma30 = get_ma(stock_data, 30)
ma60 = get_ma(stock_data, 60)
ma120 = get_ma(stock_data, 120)
ma250 = get_ma(stock_data, 250)
ema12 = get_ema(stock_data, 12)
ema26 = get_ema(stock_data, 26)
dif, dea, macd = get_macd(stock_data)
kdj_k, kdj_d, j = get_kdj(stock_data)
boll_mid, boll_up, boll_down = get_boll(stock_data)
rsi = get_rsi(stock_data)
wr = get_wr(stock_data)
cci = get_cci(stock_data)
obv = get_obv(stock_data)
stock_data['ma5'] = ma5
stock_data['ma10'] = ma10
stock_data['ma20'] = ma20
stock_data['ma30'] = ma30
stock_data['ma60'] = ma60
stock_data['ma120'] = ma120
stock_data['ma250'] = ma250
stock_data['ema12'] = em
2、股票的obv指标怎么看
累积能量线衣唱布防图事需(OBV)又称能量潮,是美浓服云国投资分析家Joe·Granville
于1981年创立的,它的理论基础是"能量是因,股价是果",即股价的上升要依靠资金能量源源不断的输入来自才能完成,是从成交量变动趋势来分析股价转势的技术指标。
1、OBV呈N字形波动,当OBV线超越前一次N字形的高点时,则记下一个向上的箭头;当
OBV线跌破前一次N的低点时,就记下一个向下的箭头。
2.当OBV线连续形成N字形上涨状态,则上涨的股价将要出现反转。
3、当OBV线在连续小N字形上涨时,又出现大N字形上涨状态,则行情随时可能出现反转。
4、OBV线的走向与股价曲线产“反向背离”时,说明当时的走势是虚假的,不管当时股价是
上涨行情还是下跌行情,都随时有反转的可能,需要格外留局武坐值棉冲心。
5、OBV线如果持续一个月以上横向移动后突然上冲,预示大行情深虽施密训流及随时可能发生。如图OB计她胞V
经过长达一个月的横盘突然上冲,在成交量的配合下,股价零编资马算加一路上扬。
3、股票的obv数值是什么意思
能量潮(OBV)一、能量潮
OBV利用股价和股票成交量的指标来反映人气兴衰,人为地按照股价的涨跌将成交量为正负,并进行累加运算。
二、公式
由于OBV的计算方法过于简单化,所以容易受到偶然因素的影响,为了提高OBV的准确性,可以采取多空比率净额法对其进行修正。
多空比率净额= [(收盘价-最低价)-(最高价-收盘价)] ÷( 最高价-最低价)×V
该方法根据多空力量比率加权修正成交量,比单纯的OBV法具有更高的可信度。
三、OBV分析要领
单纯观察OBV的方向并无实际意义,应该与价格曲线进行对照。
当OBV线下滑,而股价上升时,说明买方力量薄弱,投资者应考虑卖出;如果OBV上升,而股价下跌,表明有人逢低接盘,可适当买进;如果OBV累计值由正转负时,表明股市整体走低,应卖出股票,反之则相反;如果OBV正负值转换频率高,投资者应注意观察股市此时的盘整行情,择机而动。
OBV体现了人气动向,可变量很大,人气很难维持很长时间,因此,短期投资者应主要参考该指标,长期投资者不宜受OBV指标影响。