本文整理汇总了Python中talib.PLUS_DM属性的典型用法代码示例。如果您正苦于以下问题:Python talib.PLUS_DM属性的具体用法?Python talib.PLUS_DM怎么用?Python talib.PLUS_DM使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类talib
的用法示例。
在下文中一共展示了talib.PLUS_DM属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_PLUS_DM
# 需要导入模块: import talib [as 别名]
# 或者: from talib import PLUS_DM [as 别名]
def add_PLUS_DM(self, timeperiod=14,
type='line', color='increasing', **kwargs):
"""Plus Directional Movement."""
if not (self.has_high and self.has_low):
raise Exception()
utils.kwargs_check(kwargs, VALID_TA_KWARGS)
if 'kind' in kwargs:
type = kwargs['kind']
name = 'PLUS_DM({})'.format(str(timeperiod))
self.sec[name] = dict(type=type, color=color)
self.ind[name] = talib.PLUS_DM(self.df[self.hi].values,
self.df[self.lo].values,
timeperiod)
示例2: dm
# 需要导入模块: import talib [as 别名]
# 或者: from talib import PLUS_DM [as 别名]
def dm(candles: np.ndarray, period=14, sequential=False) -> DM:
"""
DM - Directional Movement
:param candles: np.ndarray
:param period: int - default=14
:param sequential: bool - default=False
:return: DM(plus, minus)
"""
if not sequential and len(candles) > 240:
candles = candles[-240:]
MINUS_DI = talib.MINUS_DM(candles[:, 3], candles[:, 4], timeperiod=period)
PLUS_DI = talib.PLUS_DM(candles[:, 3], candles[:, 4], timeperiod=period)
if sequential:
return DM(PLUS_DI, MINUS_DI)
else:
return DM(PLUS_DI[-1], MINUS_DI[-1])
示例3: plus_dm
# 需要导入模块: import talib [as 别名]
# 或者: from talib import PLUS_DM [as 别名]
def plus_dm(self, sym, frequency, *args, **kwargs):
if not self.kbars_ready(sym, frequency):
return []
highs = self.high(sym, frequency)
lows = self.low(sym, frequency)
return ta.PLUS_DM(highs, lows, *args, **kwargs)
示例4: PLUS_DM
# 需要导入模块: import talib [as 别名]
# 或者: from talib import PLUS_DM [as 别名]
def PLUS_DM(frame, n=14, high_col='high', low_col='low'):
return _frame_to_series(frame, [high_col, low_col], talib.PLUS_DM, n)
示例5: PLUS_DM
# 需要导入模块: import talib [as 别名]
# 或者: from talib import PLUS_DM [as 别名]
def PLUS_DM(data, **kwargs):
_check_talib_presence()
_, phigh, plow, _, _ = _extract_ohlc(data)
return talib.PLUS_DM(phigh, plow, **kwargs)