Python talib.PLUS_DM Examples

The following are 5 code examples of talib.PLUS_DM(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module talib , or try the search function .
Example #1
Source File: ta.py    From dash-technical-charting with MIT License 6 votes vote down vote up
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) 
Example #2
Source File: dm.py    From jesse with MIT License 6 votes vote down vote up
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]) 
Example #3
Source File: ta_indicator_mixin.py    From strategy with Apache License 2.0 5 votes vote down vote up
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) 
Example #4
Source File: talib_wrapper.py    From tia with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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) 
Example #5
Source File: talib_indicators.py    From qtpylib with Apache License 2.0 5 votes vote down vote up
def PLUS_DM(data, **kwargs):
    _check_talib_presence()
    _, phigh, plow, _, _ = _extract_ohlc(data)
    return talib.PLUS_DM(phigh, plow, **kwargs)