本文整理匯總了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)