当前位置: 首页>>代码示例>>Python>>正文


Python talib.MAX属性代码示例

本文整理汇总了Python中talib.MAX属性的典型用法代码示例。如果您正苦于以下问题:Python talib.MAX属性的具体用法?Python talib.MAX怎么用?Python talib.MAX使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在talib的用法示例。


在下文中一共展示了talib.MAX属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: donchian

# 需要导入模块: import talib [as 别名]
# 或者: from talib import MAX [as 别名]
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]) 
开发者ID:jesse-ai,项目名称:jesse,代码行数:23,代码来源:donchian.py

示例2: QSDD

# 需要导入模块: import talib [as 别名]
# 或者: from talib import MAX [as 别名]
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 
开发者ID:QUANTAXIS,项目名称:QUANTAXIS,代码行数:33,代码来源:strategy_qsdd.py

示例3: calculate_cmi_indicator

# 需要导入模块: import talib [as 别名]
# 或者: from talib import MAX [as 别名]
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 
开发者ID:ramoslin02,项目名称:51bitqunt,代码行数:11,代码来源:technical_indicators.py

示例4: donchian

# 需要导入模块: import talib [as 别名]
# 或者: from talib import MAX [as 别名]
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] 
开发者ID:ramoslin02,项目名称:51bitqunt,代码行数:12,代码来源:array_manager.py

示例5: MAX

# 需要导入模块: import talib [as 别名]
# 或者: from talib import MAX [as 别名]
def MAX(series, n=30):
    return _series_to_series(series, talib.MAX, n) 
开发者ID:bpsmith,项目名称:tia,代码行数:4,代码来源:talib_wrapper.py

示例6: MINMAX

# 需要导入模块: import talib [as 别名]
# 或者: from talib import MAX [as 别名]
def MINMAX(series, n=30):
    return _series_to_frame(series, ['MIN', 'MAX'], talib.MINMAX, n) 
开发者ID:bpsmith,项目名称:tia,代码行数:4,代码来源:talib_wrapper.py

示例7: MAX

# 需要导入模块: import talib [as 别名]
# 或者: from talib import MAX [as 别名]
def MAX(data, **kwargs):
    _check_talib_presence()
    prices = _extract_series(data)
    return talib.MAX(prices, **kwargs) 
开发者ID:ranaroussi,项目名称:qtpylib,代码行数:6,代码来源:talib_indicators.py

示例8: getHighest

# 需要导入模块: import talib [as 别名]
# 或者: from talib import MAX [as 别名]
def getHighest(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.MAX(arr, length) 
开发者ID:epolestar,项目名称:equant,代码行数:11,代码来源:strategy_model.py

示例9: handle_data

# 需要导入模块: import talib [as 别名]
# 或者: from talib import MAX [as 别名]
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 
开发者ID:epolestar,项目名称:equant,代码行数:28,代码来源:GoStraight.py


注:本文中的talib.MAX属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。