Python talib.TRIX Examples
The following are 5
code examples of talib.TRIX().
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: trix.py From jesse with MIT License | 6 votes |
def trix(candles: np.ndarray, period=18, source_type="close", sequential=False) -> Union[float, np.ndarray]: """ TRIX - 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA :param candles: np.ndarray :param period: int - default: 18 :param source_type: str - default: "close" :param sequential: bool - default=False :return: float | np.ndarray """ if not sequential and len(candles) > 240: candles = candles[-240:] source = get_candle_source(candles, source_type=source_type) r = talib.TRIX(source, timeperiod=period) * 100 return r if sequential else r[-1]
Example #2
Source File: ta.py From dash-technical-charting with MIT License | 5 votes |
def add_TRIX(self, timeperiod=15, type='area', color='secondary', **kwargs): """1-day Rate of Change of Triple Smooth EMA.""" if not self.has_close: raise Exception() utils.kwargs_check(kwargs, VALID_TA_KWARGS) if 'kind' in kwargs: type = kwargs['kind'] name = 'TRIX({})'.format(str(timeperiod)) self.sec[name] = dict(type=type, color=color) self.ind[name] = talib.TRIX(self.df[self.cl].values, timeperiod)
Example #3
Source File: test_reg.py From finta with GNU Lesser General Public License v3.0 | 5 votes |
def test_trix(): '''test TA.TRIX''' ma = TA.TRIX(ohlc, 20) talib_ma = talib.TRIX(ohlc['close'], timeperiod=20) assert round(talib_ma[-1], 2) == round(ma.values[-1], 2)
Example #4
Source File: talib_wrapper.py From tia with BSD 3-Clause "New" or "Revised" License | 5 votes |
def TRIX(series, n=30): return _series_to_series(series, talib.TRIX, n)
Example #5
Source File: talib_indicators.py From qtpylib with Apache License 2.0 | 5 votes |
def TRIX(data, **kwargs): _check_talib_presence() prices = _extract_series(data) return talib.TRIX(prices, **kwargs)