我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用talib.WILLR。
def add_WILLR(self, timeperiod=14, type='line', color='secondary', **kwargs): """Williams %R.""" if not (self.has_high and self.has_low and self.has_close): raise Exception() utils.kwargs_check(kwargs, VALID_TA_KWARGS) if 'kind' in kwargs: type = kwargs['kind'] name = 'WILLR({})'.format(str(timeperiod)) self.sec[name] = dict(type=type, color=color) self.ind[name] = talib.WILLR(self.df[self.hi].values, self.df[self.lo].values, self.df[self.cl].values, timeperiod)
def WR_CN(high, low, close, timeperiod=9): return -tl.WILLR(high, low, close, timeperiod) #MAX
def WILLR(self): """?KDJ??, 0?-20??? 80?-100??""" closes = self.getCloses() highs = self.getHighs() lows = self.getLows() return talib.WILLR(highs,lows,closes) #----------------------------------------------------------------------
def WILLR(highs, lows, closes): """0?-100???, ?KDJ??, 0?-20??? -80?-100?? return: wr """ highs = np.array(highs) lows = np.array(lows) closes = np.array(closes) return talib.WILLR(highs,lows,closes)