Ejemplo n.º 1
0
def MAVP(inputs,
         periods: str = 'periods',
         minperiod=2,
         maxperiod=30,
         matype: MA_Type = MA_Type.SMA,
         price_type: str = 'close'):
    """
    {'name': 'MAVP',
     'group': 'Overlap Studies',
     'display_name': 'Moving average with variable period',
     'function_flags': ['Output scale same as input'],
     'input_names': OrderedDict([('price', 'close'), ('periods', 'periods')]),
     'parameters': OrderedDict([('minperiod', 2),
                  ('maxperiod', 30),
                  ('matype', 0)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}

    :param inputs:
    :param minperiod:
    :param maxperiod:
    :param matype:
    :param price_type:
    :return:
    """

    indicator = abstract.Function('MAVP')
    if not utils.check(inputs, [price_type, periods]):
        raise ValueError('')
    return indicator(inputs,
                     periods=periods,
                     minperiod=minperiod,
                     maxperiod=maxperiod,
                     matype=matype.value,
                     price=price_type)
Ejemplo n.º 2
0
def ADX(inputs, period=14, prices: list or None = None):
    """

    https://www.investopedia.com/terms/a/adx.asp

    {'name': 'ADX',
    'group': 'Momentum Indicators',
    'display_name': 'Average Directional Movement Index',
    'function_flags': ['Function has an unstable period'],
    'input_names': OrderedDict([('prices', ['high', 'low', 'close'])]),
    'parameters': OrderedDict([('timeperiod', 14)]),
    'output_flags': OrderedDict([('real', ['Line'])]),
    'output_names': ['real']}

    :param inputs:
    :param period:
    :param prices:
    :return:
    """
    if prices is None:
        prices = ['high', 'low', 'close']
    indicator = abstract.Function('ADX')
    if not utils.check(inputs, prices):
        raise ValueError('Expect {} in the inputs. But only {}'.format(
            str(prices),
            str(inputs.columns)
            if isinstance(inputs, pd.DataFrame) else inputs.keys()))
    return indicator(inputs, timeperiod=period, prices=prices)
Ejemplo n.º 3
0
def SAR(inputs, acceleration: float = 0.02, period: int = 14, prices=None):
    """
    {'name': 'SAR',
     'group': 'Overlap Studies',
     'display_name': 'Parabolic SAR',
     'function_flags': ['Output scale same as input'],
     'input_names': OrderedDict([('prices', ['high', 'low'])]),
     'parameters': OrderedDict([('acceleration', 0.02), ('maximum', 0.2)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :param inputs:
    :param acceleration:
    :param period:
    :param prices:
    :return:
    """
    if prices is None:
        prices = ['high', 'low']
    indicator = abstract.Function('SAR')
    if not utils.check(inputs, prices):
        raise ValueError('')
    return indicator(inputs,
                     acceleration=acceleration,
                     timeperiod=period,
                     prices=prices)
Ejemplo n.º 4
0
def ULTOSC(inputs,
           period1: int = 7,
           period2: int = 14,
           period3: int = 28,
           prices: list or None = None):
    """
    {'name': 'ULTOSC',
     'group': 'Momentum Indicators',
     'display_name': 'Ultimate Oscillator',
     'function_flags': None,
     'input_names': OrderedDict([('prices', ['high', 'low', 'close'])]),
     'parameters': OrderedDict([('timeperiod1', 7),
                  ('timeperiod2', 14),
                  ('timeperiod3', 28)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :param inputs:
    :param period1:
    :param period2:
    :param period3:
    :param prices:
    :return:
    """
    if prices is None:
        prices = ['high', 'low', 'close']
    indicator = abstract.Function('ULTOSC')
    if not utils.check(inputs, prices):
        raise ValueError('')
    return indicator(inputs,
                     timeperiod1=period1,
                     timeperiod2=period2,
                     timeperiod3=period3,
                     prices=prices)
Ejemplo n.º 5
0
def STOCHF(inputs,
           fastk_period: int = 5,
           fastd_period: int = 3,
           fastd_matype: MA_Type = MA_Type.SMA,
           prices: list or None = None):
    """
    {'name': 'STOCHF',
     'group': 'Momentum Indicators',
     'display_name': 'Stochastic Fast',
     'function_flags': None,
     'input_names': OrderedDict([('prices', ['high', 'low', 'close'])]),
     'parameters': OrderedDict([('fastk_period', 5),
                  ('fastd_period', 3),
                  ('fastd_matype', 0)]),
     'output_flags': OrderedDict([('fastk', ['Line']), ('fastd', ['Line'])]),
     'output_names': ['fastk', 'fastd']}

    :param inputs:
    :param fastk_period:
    :param fastd_period:
    :param fastd_matype:
    :param prices:
    :return:
    """
    if prices is None:
        prices = ['high', 'low', 'close']
    indicator = abstract.Function('STOCHF')
    if not utils.check(inputs, prices):
        raise ValueError('')
    return indicator(inputs,
                     fastk_period=fastk_period,
                     fastd_period=fastd_period,
                     fastd_matype=fastd_matype.value,
                     prices=prices)
Ejemplo n.º 6
0
def APO(inputs,
        fastperiod: int = 12,
        slowperiod: int = 26,
        matype: MA_Type = MA_Type.SMA,
        price_type: str = 'close'):
    """
    {'name': 'APO',
     'group': 'Momentum Indicators',
     'display_name': 'Absolute Price Oscillator',
     'function_flags': None,
     'input_names': OrderedDict([('price', 'close')]),
     'parameters': OrderedDict([('fastperiod', 12),
                                ('slowperiod', 26),
                                ('matype', 0)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :param inputs:
    :param fastperiod:
    :param slowperiod:
    :param matype:
    :param price_type:
    :return:
    """
    indicator = abstract.Function('APO')
    if not utils.check(inputs, [price_type]):
        raise ValueError('')
    return indicator(inputs,
                     fastperiod=fastperiod,
                     slowperiod=slowperiod,
                     matype=matype.value,
                     price=price_type)
Ejemplo n.º 7
0
def AROON(inputs, period=14, prices: list or None = None):
    """
    {'name': 'AROON',
    'group': 'Momentum Indicators',
    'display_name': 'Aroon',
    'function_flags': None,
    'input_names': OrderedDict([('prices', ['high', 'low'])]),
    'parameters': OrderedDict([('timeperiod', 14)]),
    'output_flags': OrderedDict([('aroondown', ['Dashed Line']),
              ('aroonup', ['Line'])]),
    'output_names': ['aroondown', 'aroonup']}


    :param inputs:
    :param period:
    :param prices:
    :return: ['aroondown', 'aroonup']
    """
    if prices is None:
        prices = ['high', 'low']

    indicator = abstract.Function('AROON')
    if not utils.check(inputs, prices):
        raise ValueError('')
    return indicator(inputs, timeperiod=period, prices=prices)
Ejemplo n.º 8
0
def MAMA(inputs,
         fastlimit: int = 0.5,
         slowlimit: int = 0.05,
         price_type: str = 'close'):
    """
    {'name': 'MAMA',
    'group': 'Overlap Studies',
    'display_name': 'MESA Adaptive Moving Average',
    'function_flags': ['Output scale same as input',
    'Function has an unstable period'],
    'input_names': OrderedDict([('price', 'close')]),
    'parameters': OrderedDict([('fastlimit', 0.5), ('slowlimit', 0.05)]),
    'output_flags': OrderedDict([('mama', ['Line']), ('fama', ['Dashed Line'])]),
    'output_names': ['mama', 'fama']}
    :param inputs:
    :param fastlimit:
    :param slowlimit:
    :param price_type:
    :return:
    """

    indicator = abstract.Function('MAMA')
    if not utils.check(inputs, [price_type]):
        raise ValueError('')
    return indicator(inputs,
                     fastlimit=fastlimit,
                     slowlimit=slowlimit,
                     price=price_type)
Ejemplo n.º 9
0
def MACD(inputs,
         fastperiod: int = 12,
         slowperiod: int = 26,
         signalperiod: int = 9,
         price_type: str = 'close'):
    """
    {'name': 'MACD',
     'group': 'Momentum Indicators',
     'display_name': 'Moving Average Convergence/Divergence',
     'function_flags': None,
     'input_names': OrderedDict([('price', 'close')]),
     'parameters': OrderedDict([('fastperiod', 12),
                  ('slowperiod', 26),
                  ('signalperiod', 9)]),
     'output_flags': OrderedDict([('macd', ['Line']),
                  ('macdsignal', ['Dashed Line']),
                  ('macdhist', ['Histogram'])]),
     'output_names': ['macd', 'macdsignal', 'macdhist']}
    :param inputs:
    :param fastperiod:
    :param slowperiod:
    :param signalperiod:
    :param price_type:
    :return:
    """
    indicator = abstract.Function('MACD')
    if not utils.check(inputs, [price_type]):
        raise ValueError('')
    return indicator(inputs,
                     fastperiod=fastperiod,
                     slowperiod=slowperiod,
                     signalperiod=signalperiod,
                     price=price_type)
Ejemplo n.º 10
0
def ADOSC(inputs, fastperiod: int = 3, slowperiod: int = 10, prices=None):
    """
    {'name': 'ADOSC',
     'group': 'Volume Indicators',
     'display_name': 'Chaikin A/D Oscillator',
     'function_flags': None,
     'input_names': OrderedDict([('prices', ['high', 'low', 'close', 'volume'])]),
     'parameters': OrderedDict([('fastperiod', 3), ('slowperiod', 10)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}

    :param inputs:
    :param fastperiod:
    :param slowperiod:
    :param prices:
    :return:
    """
    if prices is None:
        prices = ['high', 'low', 'close', 'volume']
    indicator = abstract.Function('ADOSC')
    if not utils.check(inputs, prices):
        raise ValueError('')
    return indicator(inputs,
                     fastperiod=fastperiod,
                     slowperiod=slowperiod,
                     prices=prices)
Ejemplo n.º 11
0
def STOCHRSI(inputs,
             period: int = 14,
             fastk_period: int = 5,
             fastd_period: int = 3,
             fastd_matype: MA_Type = MA_Type.SMA,
             price_type: str = 'close'):
    """
    {'name': 'STOCHRSI',
     'group': 'Momentum Indicators',
     'display_name': 'Stochastic Relative Strength Index',
     'function_flags': ['Function has an unstable period'],
     'input_names': OrderedDict([('price', 'close')]),
     'parameters': OrderedDict([('timeperiod', 14),
                  ('fastk_period', 5),
                  ('fastd_period', 3),
                  ('fastd_matype', 0)]),
     'output_flags': OrderedDict([('fastk', ['Line']), ('fastd', ['Line'])]),
     'output_names': ['fastk', 'fastd']}
    :param inputs:
    :param period:
    :param fastk_period:
    :param fastd_period:
    :param fastd_matype:
    :param price_type:
    :return:
    """
    indicator = abstract.Function('STOCHRSI')
    if not utils.check(inputs, [price_type]):
        raise ValueError('')
    return indicator(inputs,
                     timeperiod=period,
                     fastk_period=fastk_period,
                     fastd_period=fastd_period,
                     fastd_matype=fastd_matype.value,
                     price=price_type)
Ejemplo n.º 12
0
def SAREXT(inputs,
           offsetonreverse: float = 0.0,
           accelerationinitlong=0.02,
           accelerationlong=0.02,
           accelerationmaxlong=0.2,
           accelerationinitshort=0.02,
           accelerationshort=0.02,
           accelerationmaxshort=0.2,
           prices=None):
    """
    {'name': 'SAREXT',
     'group': 'Overlap Studies',
     'display_name': 'Parabolic SAR - Extended',
     'function_flags': ['Output scale same as input'],
     'input_names': OrderedDict([('prices', ['high', 'low'])]),
     'parameters': OrderedDict([('startvalue', 0),
                  ('offsetonreverse', 0),
                  ('accelerationinitlong', 0.02),
                  ('accelerationlong', 0.02),
                  ('accelerationmaxlong', 0.2),
                  ('accelerationinitshort', 0.02),
                  ('accelerationshort', 0.02),
                  ('accelerationmaxshort', 0.2)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
    'output_names': ['real']}
    :param inputs:
    :param offsetonreverse:
    :param accelerationinitlong:
    :param accelerationlong:
    :param accelerationmaxlong:
    :param accelerationinitshort:
    :param accelerationshort:
    :param accelerationmaxshort:
    :param prices:
    :return:
    """
    if prices is None:
        prices = ['high', 'low']
    indicator = abstract.Function('SAREXT')
    if not utils.check(inputs, prices):
        raise ValueError('')
    return indicator(inputs,
                     offsetonreverse=offsetonreverse,
                     accelerationinitlong=accelerationinitlong,
                     accelerationlong=accelerationlong,
                     accelerationmaxlong=accelerationmaxlong,
                     accelerationinitshort=accelerationinitshort,
                     accelerationshort=accelerationshort,
                     accelerationmaxshort=accelerationmaxshort,
                     prices=prices)
Ejemplo n.º 13
0
def TSF(inputs, timeperiod: int = 14, price_type='close'):
    """
    {'name': 'TSF',
     'group': 'Statistic Functions',
     'display_name': 'Time Series Forecast',
     'function_flags': ['Output scale same as input'],
     'input_names': OrderedDict([('price', 'close')]),
     'parameters': OrderedDict([('timeperiod', 14)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :return:
    """
    indicator = abstract.Function('TSF')
    if not utils.check(inputs, [price_type]):
        raise ValueError('')
    return indicator(inputs, timeperiod=timeperiod, price=price_type)
Ejemplo n.º 14
0
def LINEARREG_INTERCEPT(inputs, timeperiod: int = 14, price_type='close'):
    """
    {'name': 'LINEARREG_INTERCEPT',
     'group': 'Statistic Functions',
     'display_name': 'Linear Regression Intercept',
     'function_flags': ['Output scale same as input'],
     'input_names': OrderedDict([('price', 'close')]),
     'parameters': OrderedDict([('timeperiod', 14)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :return:
    """
    indicator = abstract.Function('LINEARREG_INTERCEPT')
    if not utils.check(inputs, [price_type]):
        raise ValueError('')
    return indicator(inputs, timeperiod=timeperiod, price=price_type)
Ejemplo n.º 15
0
def MACDEXT(inputs,
            fastperiod: int = 12,
            fastmatype: MA_Type = MA_Type.SMA,
            slowperiod: int = 26,
            slowmatype: MA_Type = MA_Type.SMA,
            signalperiod: int = 9,
            signalmatype: MA_Type = MA_Type.SMA,
            price_type: str = 'close'):
    """
    {'name': 'MACDEXT',
     'group': 'Momentum Indicators',
     'display_name': 'MACD with controllable MA type',
     'function_flags': None,
     'input_names': OrderedDict([('price', 'close')]),
     'parameters': OrderedDict([('fastperiod', 12),
                  ('fastmatype', 0),
                  ('slowperiod', 26),
                  ('slowmatype', 0),
                  ('signalperiod', 9),
                  ('signalmatype', 0)]),
     'output_flags': OrderedDict([('macd', ['Line']),
                  ('macdsignal', ['Dashed Line']),
                  ('macdhist', ['Histogram'])]),
     'output_names': ['macd', 'macdsignal', 'macdhist']}
    :param inputs:
    :param fastperiod:
    :param fastmatype:
    :param slowperiod:
    :param slowmatype:
    :param signalperiod:
    :param signalmatype:
    :param price_type:
    :return:
    """

    indicator = abstract.Function('MACDEXT')
    if not utils.check(inputs, [price_type]):
        raise ValueError('')
    return indicator(inputs,
                     fastperiod=fastperiod,
                     fastmatype=fastmatype.value,
                     slowperiod=slowperiod,
                     slowmatype=slowmatype.value,
                     signalperiod=signalperiod,
                     signalmatype=signalmatype.value,
                     price=price_type)
Ejemplo n.º 16
0
def CDL2CROWS(inputs, prices: list or None = None):
    """
    {'name': 'CDL2CROWS', 'group': 'Pattern Recognition', 'display_name': 'Two Crows',
              'function_flags': ['Output is a candlestick'],
              'input_names': OrderedDict([('prices', ['open', 'high', 'low', 'close'])]),
              'parameters': OrderedDict(),
              'output_flags': OrderedDict([('integer', ['Line'])]), 'output_names': ['integer']}
    :param inputs:
    :return:
    """
    if prices is None:
        prices = ['open', 'high', 'low', 'close']

    indicator = abstract.Function('CDL2CROWS')
    if not utils.check(inputs, prices):
        raise ValueError('')
    return indicator(inputs)
Ejemplo n.º 17
0
def ATR(inputs, period: int = 14, prices=None):
    """
    {'name': 'ATR',
     'group': 'Volatility Indicators',
     'display_name': 'Average True Range',
     'function_flags': ['Function has an unstable period'],
     'input_names': OrderedDict([('prices', ['high', 'low', 'close'])]),
     'parameters': OrderedDict([('timeperiod', 14)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :return:
    """
    if prices is None:
        prices = ['high', 'low', 'close']
    indicator = abstract.Function('ATR')
    if not utils.check(inputs, prices):
        raise ValueError('')
    return indicator(inputs, timeperiod=period, prices=prices)
Ejemplo n.º 18
0
def VAR(inputs, timeperiod: int = 5, nbdev: float = 1.0, price_type='close'):
    """
    {'name': 'VAR',
     'group': 'Statistic Functions',
     'display_name': 'Variance',
     'function_flags': None,
     'input_names': OrderedDict([('price', 'close')]),
     'parameters': OrderedDict([('timeperiod', 5), ('nbdev', 1)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :return:
    """
    indicator = abstract.Function('VAR')
    if not utils.check(inputs, [price_type]):
        raise ValueError('')
    return indicator(inputs,
                     timeperiod=timeperiod,
                     nbdev=nbdev,
                     price=price_type)
Ejemplo n.º 19
0
def WMA(inputs, period: int = 30, price_type: str = 'close'):
    """
    {'name': 'WMA',
     'group': 'Overlap Studies',
     'display_name': 'Weighted Moving Average',
     'function_flags': ['Output scale same as input'],
     'input_names': OrderedDict([('price', 'close')]),
     'parameters': OrderedDict([('timeperiod', 30)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :param inputs:
    :param period:
    :param price_type:
    :return:
    """
    indicator = abstract.Function('WMA')
    if not utils.check(inputs, [price_type]):
        raise ValueError('')
    return indicator(inputs, timeperiod=period, price=price_type)
Ejemplo n.º 20
0
def HT_TRENDLINE(inputs, price_type: str = 'close'):
    """
    {'name': 'HT_TRENDLINE',
     'group': 'Overlap Studies',
     'display_name': 'Hilbert Transform - Instantaneous Trendline',
     'function_flags': ['Output scale same as input',
      'Function has an unstable period'],
     'input_names': OrderedDict([('price', 'close')]),
     'parameters': OrderedDict(),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :param inputs:
    :param price_type:
    :return:
    """
    indicator = abstract.Function('HT_TRENDLINE')
    if not utils.check(inputs, [price_type]):
        raise ValueError('')
    return indicator(inputs, price=price_type)
Ejemplo n.º 21
0
def BETA(inputs, timeperiod: int = 5, price0='high', price1='low'):
    """
    {'name': 'BETA',
    'group': 'Statistic Functions',
    'display_name': 'Beta',
    'function_flags': None,
     'input_names': OrderedDict([('price0', 'high'), ('price1', 'low')]),
     'parameters': OrderedDict([('timeperiod', 5)]), 'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :param inputs:
    :return:
    """
    indicator = abstract.Function('BETA')
    if not utils.check(inputs, [price0, price1]):
        raise ValueError('')
    return indicator(inputs,
                     timeperiod=timeperiod,
                     price0=price0,
                     price1=price1)
Ejemplo n.º 22
0
def TRIX(inputs, period: int = 30, price_type: str = 'close'):
    """
    {'name': 'TRIX',
     'group': 'Momentum Indicators',
     'display_name': '1-day Rate-Of-Change (ROC) of a Triple Smooth EMA',
     'function_flags': None,
     'input_names': OrderedDict([('price', 'close')]),
     'parameters': OrderedDict([('timeperiod', 30)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :param inputs:
    :param period:
    :param price_type:
    :return:
    """
    indicator = abstract.Function('TRIX')
    if not utils.check(inputs, [price_type]):
        raise ValueError('')
    return indicator(inputs, timeperiod=period, price=price_type)
Ejemplo n.º 23
0
def ROCP(inputs, period: int = 10, price_type: str = 'close'):
    """
    {'name': 'ROCP',
     'group': 'Momentum Indicators',
     'display_name': 'Rate of change Percentage: (price-prevPrice)/prevPrice',
     'function_flags': None,
     'input_names': OrderedDict([('price', 'close')]),
     'parameters': OrderedDict([('timeperiod', 10)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :param inputs:
    :param period:
    :param price_type:
    :return:
    """
    indicator = abstract.Function('ROCP')
    if not utils.check(inputs, [price_type]):
        raise ValueError('')
    return indicator(inputs, timeperiod=period, price=price_type)
Ejemplo n.º 24
0
def CORREL(inputs, timeperiod: int = 30, price0='high', price1='low'):
    """
    {'name': 'CORREL',
    'group': 'Statistic Functions',
    'display_name': "Pearson's Correlation Coefficient (r)",
    'function_flags': None,
    'input_names': OrderedDict([('price0', 'high'), ('price1', 'low')]),
    'parameters': OrderedDict([('timeperiod', 30)]),
    'output_flags': OrderedDict([('real', ['Line'])]),
    'output_names': ['real']}

    :return:
    """
    indicator = abstract.Function('BETA')
    if not utils.check(inputs, [price0, price1]):
        raise ValueError('')
    return indicator(inputs,
                     timeperiod=timeperiod,
                     price0=price0,
                     price1=price1)
Ejemplo n.º 25
0
def AD(inputs, prices=None):
    """
    {'name': 'AD',
     'group': 'Volume Indicators',
     'display_name': 'Chaikin A/D Line',
     'function_flags': None,
     'input_names': OrderedDict([('prices', ['high', 'low', 'close', 'volume'])]),
     'parameters': OrderedDict(),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :param inputs:
    :param prices:
    :return:
    """
    if prices is None:
        prices = ['high', 'low', 'close', 'volume']
    indicator = abstract.Function('AD')
    if not utils.check(inputs, prices):
        raise ValueError('')
    return indicator(inputs, prices=prices)
Ejemplo n.º 26
0
def RSI(inputs, period: int = 14, price_type: str = 'close'):
    """
    {'name': 'RSI',
     'group': 'Momentum Indicators',
     'display_name': 'Relative Strength Index',
     'function_flags': ['Function has an unstable period'],
     'input_names': OrderedDict([('price', 'close')]),
     'parameters': OrderedDict([('timeperiod', 14)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}

    :param inputs:
    :param period:
    :param price_type:
    :return:
    """
    indicator = abstract.Function('RSI')
    if not utils.check(inputs, [price_type]):
        raise ValueError('')
    return indicator(inputs, timeperiod=period, price=price_type)
Ejemplo n.º 27
0
def TRANGE(inputs, prices: list or None = None):
    """
    {'name': 'TRANGE',
     'group': 'Volatility Indicators',
     'display_name': 'True Range',
     'function_flags': None,
     'input_names': OrderedDict([('prices', ['high', 'low', 'close'])]),
     'parameters': OrderedDict(),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}

    :param inputs:
    :param prices:
    :return:
    """
    if prices is None:
        prices = ['high', 'low', 'close']
    indicator = abstract.Function('TRANGE')
    if not utils.check(inputs, prices):
        raise ValueError('')
    return indicator(inputs, prices=prices)
Ejemplo n.º 28
0
def BOP(inputs, prices: list or None = None):
    """
    {'name': 'BOP',
    'group': 'Momentum Indicators',
     'display_name': 'Balance Of Power',
     'function_flags': None,
     'input_names': OrderedDict([('prices', ['open', 'high', 'low', 'close'])]),
     'parameters': OrderedDict(),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :param inputs:
    :param prices:
    :return:
    """

    if prices is None:
        prices = ['open', 'high', 'low', 'close']
    indicator = abstract.Function('BOP')
    if not utils.check(inputs, prices):
        raise ValueError('')
    return indicator(inputs, prices=prices)
Ejemplo n.º 29
0
def PLUS_DM(inputs, period: int = 14, prices: list or None = None):
    """
    {'name': 'PLUS_DM',
     'group': 'Momentum Indicators',
     'display_name': 'Plus Directional Movement',
     'function_flags': ['Function has an unstable period'],
     'input_names': OrderedDict([('prices', ['high', 'low'])]),
     'parameters': OrderedDict([('timeperiod', 14)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :param inputs:
    :param period:
    :param prices:
    :return:
    """
    if prices is None:
        prices = ['high', 'low']
    indicator = abstract.Function('PLUS_DM')
    if not utils.check(inputs, prices):
        raise ValueError('')
    return indicator(inputs, timeperiod=period, prices=prices)
Ejemplo n.º 30
0
def CCI(inputs, period: int = 14, prices: list or None = None):
    """
    {'name': 'CCI',
     'group': 'Momentum Indicators',
     'display_name': 'Commodity Channel Index',
     'function_flags': None,
     'input_names': OrderedDict([('prices', ['high', 'low', 'close'])]),
     'parameters': OrderedDict([('timeperiod', 14)]),
     'output_flags': OrderedDict([('real', ['Line'])]),
     'output_names': ['real']}
    :param inputs:
    :param period:
    :param prices:
    :return:
    """
    if prices is None:
        prices = ['high', 'low', 'close']
    indicator = abstract.Function('CCI')
    if not utils.check(inputs, prices):
        raise ValueError('')
    return indicator(inputs, timeperiod=period, prices=prices)