关于obv指标 设置内容导航:
1、obv指标 设置
def set_obv(self):
self.obv = ta.OBV(self.df['close'], self.df['volume'])
self.df['obv'] = self.obv
self.df['obv_ma'] = ta.MA(self.obv, timeperiod=self.obv_ma_period)
self.df['obv_ma_diff'] = self.df['obv'] - self.df['obv_ma']
self.df['obv_ma_diff_rate'] = self.df['obv_ma_diff'] / self.df['obv_ma']
self.df['obv_ma_diff_rate_ma'] = ta.MA(self.df['obv_ma_diff_rate'], timeperiod=self.obv_ma_diff_rate_ma_period)
self.df['obv_ma_diff_rate_ma_diff'] = self.df['obv_ma_diff_rate'] - self.df['obv_ma_diff_rate_ma']
self.df['obv_ma_diff_rate_ma_diff_rate'] = self.df['obv_ma_diff_rate_ma_diff'] / self.df['obv_ma_diff_rate_ma']
# 设置macd指标
def set_macd(self):
macd, macdsignal, macdhist = ta.MACD(self.df['close'], fastperiod=self.macd_fastperiod, slowperiod=self.macd_slowperiod, signalperiod=self.macd_signalperiod)
self.df['macd'] = macd
self.df['macdsignal'] = macdsignal
self.df['macdhist'] = macdhist
self.df['macd_diff'] = macd - macdsignal
self.df['macd_diff_rate'] = self.df['macd_diff'] / macdsignal
self.df['macd_diff_rate_ma'] = ta.MA(self.df['macd_diff_rate'], timeperiod=self.macd_diff_rate_ma_period)
self.df['macd_diff_rate_ma_diff'] = self.df['macd_diff_rate'] - self.df['macd_diff_rate_ma']
self.df['macd_diff_rate_ma_diff_rate'] = self.df['macd_diff_rate_ma_diff'] / self.df['macd_diff_rate_ma']
# 设置rsi指标
def set_rsi(self):
self.df['rsi'] = ta.RSI(self.df['close'], timeperiod=self.rsi_period)
self.df['rsi_ma'] = ta.MA(self.df['rsi'], timeperiod=self.rsi_ma_period)
self.df['rsi_ma_diff'] = self.df['rsi'] - self.df['rsi_ma']
self.df['rsi_ma_diff_rate'] = self.df['rsi_ma_diff'] / self.df['rsi_ma']
self.df['rsi_ma_diff_rate_ma'] = ta.MA(self.df['rsi_ma_diff_rate'], timeperiod=self.rsi_ma_diff_rate_ma_period)
self.df['rsi_ma_diff_rate_ma_diff'] = self.df['rsi_ma_diff_rate'] - self.df['rsi_ma_diff_rate_ma']
self.df['rsi_ma_diff_rate_ma_diff_rate'] = self.df['rsi_ma_diff_rate_ma_diff'] / self.df['rsi_ma_diff_rate_ma']
# 设置cci指标
def set_cci(self):
self.df['cci'] = ta.CCI(self.df['high'], self.df['low'], self.df['close'], timeperiod=self.cci_period)
self.df['cci_ma'] = ta.MA(self.df['cci'], timeperiod=self.cci_ma_period)
self.df['cci_ma_diff'] = self.df['cci'] - self.df['cci_ma']
self.df['cci_ma_diff_rate'] = self.df['cci_ma_diff'] / self.df['cci_ma']
self.df['cci_ma_diff_rate_ma'] = ta.MA(self.df['cci_ma_diff_rate'], timeperiod=self.cci_ma_diff_rate_ma_period)
self.df['cci_ma_diff_rate_ma_diff'] = self.df['cci_ma_diff_rate'] - self.df['cci_ma_diff_rate_ma']
self.df['cci_ma_diff_rate_ma_diff_rate'] = self.df['cci_ma_diff_rate_ma_diff'] / self.df['cci_ma_diff_rate_ma']
# 设置wr指标
def set_wr(self):
self.df['wr'] = ta.WILLR(self.df['high'], self.df['low'], self.df['close'], timeperiod=self.wr_period)
self.df['wr_ma'] = ta.MA(self.df['wr'], timeperiod=self.wr_ma_period)
self.df['wr_ma_diff'] = self.df['wr'] - self.df['wr_ma']
self.df['wr_ma_diff_rate'] = self.df['wr_ma_diff'] / self.df['wr_ma']
self.df['wr_ma_diff_rate_ma'] = ta.MA(self.df['wr_ma_diff_rate'], timeperiod=self.wr_ma_diff_rate_ma_period)
self.df['wr_ma_diff_rate_ma_diff'] = self.df['wr_ma_diff_rate'] - self.df['wr_ma_diff_rate_ma']
self.df['wr_ma_diff_rate_ma_diff_rate'] = self.df['wr_ma_diff_rate_ma_diff'] / self.df['wr_ma_diff_rate_ma']
# 设置dmi指标
def set_dmi(self):
self.df['dmi_plus'], self.df['dmi_minus'], self.df['dmi_adx'], self.df['dmi_adxr'] = ta.ADX(self.df['high'], self.df['low'], self.df['close'], timeperiod=self.dmi_period)
self.df['dmi_plus_ma'] = ta.MA(self.df['dmi_plus'], timeperiod=self.dmi_ma_period)
self.df['dmi_plus_ma_diff'] = self.df['dmi_plus'] - self.df['dmi_plus_ma']
self.df['dmi_plus_ma_diff_rate'] = self.df['dmi_plus_ma_diff'] / self.df['dmi_plus_ma']
self.df['dmi_plus_ma_diff_rate_ma'] = ta.MA(self.df['dmi_plus_ma_diff_rate'], timeperiod=self.dmi_ma_diff_rate_ma_period)
self.df['dmi_plus_ma_diff_rate_ma_diff'] = self.df['dmi_plus_ma_diff_rate'] - self.df['dmi_plus_ma_diff_rate_ma']
self.df['dmi_plus_ma_diff_rate_ma_diff_rate'] = self.df['dmi_plus_ma_diff_rate_ma_diff'] / self.df['dmi_plus_ma_diff_rate_ma']
self.df['dmi_minus_ma'] = ta.MA(self.df['dmi_minus'], timeperiod=self.dmi_ma_period)
self.df['dmi_minus_ma_diff'] = self.df['dmi_minus'] - self.df['dmi_minus_ma']
2、obv指标 设置
OB因免然克孙约急V线无参数。但可设置OBV来自的平均天数,就可以显示出OBV平均线,有助于判明OBV的趋势。3、obv指标 设置
M:=60;VA:=IF(CLOSE>REF(CLOSE,1),VOL,-VOL);
OBV:=SUM(IF(CLOSE=REF(CLOSE,1),0,VA),0);
MAOBV:=MA(OBV,M);
ZRXG:OBV>MAOBV;
自己去设置啊,点中OBV,然后设置天数。