Python talib.MIN Examples
The following are 10
code examples of talib.MIN().
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: donchian.py From jesse with MIT License | 8 votes |
def donchian(candles: np.ndarray, period=20, sequential=False) -> DonchianChannel: """ Donchian Channels :param candles: np.ndarray :param period: int - default: 20 :param sequential: bool - default=False :return: DonchianChannel(upperband, middleband, lowerband) """ if not sequential and len(candles) > 240: candles = candles[-240:] UC = talib.MAX(candles[:, 3], timeperiod=period) LC = talib.MIN(candles[:, 4], timeperiod=period) MC = ((UC + LC) / 2) if sequential: return DonchianChannel(UC, MC, LC) else: return DonchianChannel(UC[-1], MC[-1], LC[-1])
Example #2
Source File: technical_indicators.py From 51bitqunt with MIT License | 5 votes |
def calculate_cmi_indicator(df): # RSI cmi_period = 30 cmi_ma_period = 10 roc = df['close'].diff(cmi_period) h1 = ta.MAX(df['high'], cmi_period) - ta.MIN(df['low'], cmi_period) cmi = abs(roc / h1) * 100 cmi_ma = ta.MA(cmi, cmi_ma_period) # rolling. return cmi_ma
Example #3
Source File: array_manager.py From 51bitqunt with MIT License | 5 votes |
def donchian(self, n, array=False): """ Donchian Channel. """ up = talib.MAX(self.high, n) down = talib.MIN(self.low, n) if array: return up, down return up[-1], down[-1]
Example #4
Source File: ta_lib.py From ctpbee with MIT License | 5 votes |
def donchian(self, n, array=False): """ Donchian Channel. """ up = talib.MAX(self.high, n) down = talib.MIN(self.low, n) if array: return up, down return up[-1], down[-1]
Example #5
Source File: talib_wrapper.py From tia with BSD 3-Clause "New" or "Revised" License | 5 votes |
def MINMAX(series, n=30): return _series_to_frame(series, ['MIN', 'MAX'], talib.MINMAX, n)
Example #6
Source File: talib_wrapper.py From tia with BSD 3-Clause "New" or "Revised" License | 5 votes |
def MIN(series, n=30): return _series_to_series(series, talib.MIN, n)
Example #7
Source File: talib_indicators.py From qtpylib with Apache License 2.0 | 5 votes |
def MIN(data, **kwargs): _check_talib_presence() prices = _extract_series(data) return talib.MIN(prices, **kwargs)
Example #8
Source File: strategy_model.py From equant with GNU General Public License v2.0 | 5 votes |
def getLowest(self, price, length): if (not isinstance(price, np.ndarray) and not isinstance(price, list)) or len(price) == 0: return np.array([]) arr = np.array(price) if isinstance(price, list) else price if length <= 1: return arr return talib.MIN(arr, length)
Example #9
Source File: GoStraight.py From equant with GNU General Public License v2.0 | 5 votes |
def handle_data(context): MA1 = talib.MA(Close(), timeperiod=p) MA2 = talib.MIN(Low(), timeperiod=p) MA3 = talib.MAX(High(), timeperiod=p) #LogInfo(MA2) #LogInfo(MA3) MA4 = talib.MA(Close(), timeperiod=N1) MA5 = talib.MA(Close(), timeperiod=N2) if len(MA2) < 55 or len(MA3) < 67: return if MarketPosition() == 0: if (Close()[-1] > MA1[-1]) and (MA5[-1] > MA4[-1]) and (Close()[-1] > MA3[-N0]): Buy(1, Close()[-1]) elif (MA1[-1] > Close()[-1]) and (MA5[-1] < MA4[-1]) and (Close()[-1] < MA4[-1]): SellShort(1, Close()[-1]) else: pass else: if Close()[-1] < MA2[-N]: Sell(1, Close()[-1]) elif Close()[-1] > MA3[-N0]: BuyToCover(1,Close()[-1]) #买平仓 else: pass
Example #10
Source File: strategy_qsdd.py From QUANTAXIS with MIT License | 4 votes |
def QSDD(dataframe, SHORT=12, LONG=26, M=9): """ 1.line_mid向上突破line_long,买入信号参考。 2.line_mid向下跌破line_long,卖出信号参考。 """ OPEN = dataframe.open HIGH = dataframe.high LOW = dataframe.low CLOSE = dataframe.close # QSDD策略 # A = talib.MA(-100 * (talib.MAX(HIGH, 34) - CLOSE) / (talib.MAX(HIGH, 34) - talib.MIN(LOW, 34)), 19) # B = -100 * (talib.MAX(HIGH, 14) - CLOSE) / (talib.MAX(HIGH, 14) - talib.MIN(LOW, 14)) # D = talib.EMA(-100 * (talib.MAX(HIGH, 34) - CLOSE) / (talib.MAX(HIGH, 34) - talib.MIN(LOW, 34)), 4) A = QA.MA(-100 * (QA.HHV(HIGH, 34) - CLOSE) / (QA.HHV(HIGH, 34) - QA.LLV(LOW, 34)), 19) B = -100 * (QA.HHV(HIGH, 14) - CLOSE) / \ (QA.HHV(HIGH, 14) - QA.LLV(LOW, 14)) D = QA.EMA(-100 * (QA.HHV(HIGH, 34) - CLOSE) / (QA.HHV(HIGH, 34) - QA.LLV(LOW, 34)), 4) line_long = A + 100 line_short = B + 100 line_mid = D + 100 # 信号线 CROSS_JC = QA.CROSS(line_mid, line_long) CROSS_SC = QA.CROSS(line_long, line_mid) return pd.DataFrame({'line_mid': line_mid, 'line_long': line_long, 'CROSS_JC': CROSS_JC, 'CROSS_SC': CROSS_SC}) # create account