Indicator by Groups

Overlap

bbands

Defined by John Bollinger in the 80s. It measures volatility by defining
upper and lower bands at distance x standard deviations

Formula:
  - midband = SimpleMovingAverage(close, period)
  - topband = midband + devfactor * StandardDeviation(data, period)
  - botband = midband - devfactor * StandardDeviation(data, period)

See:
  - http://en.wikipedia.org/wiki/Bollinger_Bands


Aliases: BBANDS, BollingerBands, BOLLINGERBANDS

Inputs: close

Outputs: mid, top, bot

Params:
  - period (default: 20)
    Period to consider
  - devs (default: 2.0)
    Standard Deviations of Top/Bottom Bands
  - _ma (default: sma)
    Moving average to use
  - _stdev (default: stddev)
    Standard Deviation Calculation to use

TA-LIB (with compatibility flag "_talib=True"):

Change period to 5

dema

DEMA was first time introduced in 1994, in the article "Smoothing Data with
Faster Moving Averages" by Patrick G. Mulloy in "Technical Analysis of
Stocks & Commodities" magazine.

It attempts to reduce the inherent lag associated to Moving Averages

Formula:
  - dema = (2.0 * ema(data, period)) - ema(ema(data, period), period)

See:
  - https://en.wikipedia.org/wiki/Double_exponential_moving_average


Aliases: DEMA, DoubleExponentialMovingAverage

Inputs: close

Outputs: dema

Params:
  - period (default: 30)
    Period to consider
  - _ma (default: ema)
    Moving Average to use

ema

A Moving Average that smoothes data exponentially over time.

  - Exponential Smotthing factor: alpha = 2 / (1 + period)

Formula
  - prev = mean(data, period)
  - movav = prev * (1.0 - alpha) + newdata * alpha
  - (or alternatively #  movav = prev + alpha(new - prev))

See also:
  - http://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average


Aliases: EMA, ExponentialMovingAverage

Inputs: close

Outputs: ema

Params:
  - period (default: 30)
    Period for the moving average calculation
  - _seed (default: 0)
    Default to use average of periods as seed

ewma

This is **NOT** the `ema` or `ExponentialMovingAverage`. This is a wrap
around pandas.Series.ewm where `ewma` stands for `ExponentialWeigthedMean`
... to which later a function like `mean` is applied

Applying `mean` doesn't make it the `ExponentialMovingAverage` (aka `EMA`
or `ema`) because `ewma` in `pandas.Series` or `pandas.DataFrames` does not
support using a seed of the first n periods of an `ewm` of `span=n`

The purpose of this, is to be able to use this in place of the real `ema`
with parameters like `period` and `_seed` for compatibility.


Aliases: EWMA

Inputs: close

Outputs: ewma

Params:
  - period (default: 30)
    Default Period for the ewm calculation
  - adjust (default: False)
    Default calc individual terms like in `ema`
  - _seed (default: 0)
    (nop) for compatibility with `ema`

gdema

Described first by Tim Tillson in Stocks & Commodities V16:1, January 1998
for its use in the T3 indicator.

It generalizes the DEMA by using a "volume" factor to put weight on
the 1st or 2nd factor of the DEMA to smooth the output.

When "vfactor" is 1, the DEMA is the output. When "vfactor" is 0, the
output is s simple EMA.


Aliases: gd, GD, GDEMA, GeneralizedDEMA

Inputs: close

Outputs: gd

Params:
  - period (default: 5)
    Period to consider
  - vfactor (default: 0.7)
    volume factor
  - _ma (default: ema)
    Moving Average to use

ht_trendline

Ehlers': Hilber Transform Dominant Cycle Period

Formula:
  - From *"Rocket Science for Traders: Digital Signal Processing Applications"*

See:
  - https://www.amazon.com/Rocket-Science-Traders-Processing-Applications/dp/0471405671


Aliases: HT_TRENDLINE, HilberTransform_Trendline

Inputs: high, low

Outputs: trendline

kama

Defined by Perry Kaufman in his book `"Smarter Trading"`.

It is A Moving Average with a continuously scaled smoothing factor by
taking into account market direction and volatility. The smoothing factor
is calculated from 2 ExponetialMovingAverage smoothing factors, a fast one
and slow one.

If the market trends the value will tend to the fast ema smoothing
period. If the market doesn't trend it will move towards the slow EMA
smoothing period.

It is a subclass of SmoothingMovingAverage, overriding once to account for
the live nature of the smoothing factor

Formula:
  - direction = close - close_period
  - volatility = sumN(abs(close - close_n), period)
  - effiency_ratio = abs(direction / volatility)
  - smoothing constant fast = 2 / (fast_period + 1)
  - smoothing constant slow = 2 / (slow_period + 1)

  - smoothing factor = pow(efficienty_ratio * (fast - slow) + slow), 2)
  - kama = ewm(data, alpha=smoothing factor, period=period)

Notice that "smoothing factor" isn't a single value, hence the
exponentially weighted moving average uses a value which changes for each
step of the calculation.

The standard seed is the simple moving average, use _seed=btalib.SEED_LAST
to apply the "last" known value of the input as the seed (for compatibility
this can be simply `True` or `1`)

Because the dynamic smoothing constant has a larger period (+1) than the
actual moving average, this average has alrady a seed value when the
calculation can start. Hence the seed value (eithre the simple moving
average or the last known value, is not seen because it can be calculated
before the actual period comes in effect)

See also:
  - https://school.stockcharts.com/doku.php?id=technical_indicators:kaufman_s_adaptive_moving_average
  - http://fxcodebase.com/wiki/index.php/Kaufman's_Adaptive_Moving_Average_(KAMA)
  - http://www.metatrader5.com/en/terminal/help/analytics/indicators/trend_indicators/ama
  - http://help.cqg.com/cqgic/default.htm#!Documents/adaptivemovingaverag2.htm


Aliases: KAMA, KaufmanAdaptiveMovingAverage

Inputs: close

Outputs: kama

Params:
  - period (default: 30)
    Period to consider
  - fast (default: 2)
    Fast exponential smoothing factor
  - slow (default: 30)
    Slow exponential smoothing factor
  - _seed (default: 0)
    Default to use average of n periods as seed
  - _pvol (default: 1)
    Lookback period for volatility calculation

TA-LIB (with compatibility flag "_talib=True"):

Apply las value as seed, instead of average of period values

mama

Quoting Ehlers: "The MESA Adaptive Moving Average (MAMA) adapts to price
movement in an entirely new and unique way. The adapation is based on the
rate change of phase as measured by the Hilbert Transform Discriminator"

Formula:
  - The formula is overly complex. See the linked PDF from Ehlers himself

See:
  - https://www.mesasoftware.com/papers/MAMA.pdf


Aliases: MAMA, MesaAdaptiveMovingAverage

Inputs: high, low

Outputs: mama, fama

Params:
  - fastlimit (default: 0.5)
    Fast Limit
  - slowlimit (default: 0.05)
    Fast Limit

mavp

Moving Average Variable Period.

It takes two inputs of equal length

  - data (usually the "close"
  - periods

It delivers for each timepoint "i", the value of the moving average
dictated by period[i], at point it (movingaverage[i])

Formula:
  - mavp[i] = MovingAverage(data, period[i])[i]

See also:
  - (None)


Aliases: MAVP, MovingAverageVariablePeriod

Inputs: close, periods

Outputs: mavp

Params:
  - minperiod (default: 2)
    Minimum allowed period for the moving averages
  - maxperiod (default: 30)
    Maximum allowed period for the moving averages
  - _ma (default: sma)
    Moving Average to use

midpoint

Calculates the middle price of the highest/lowest price across a period

Formula:
  - midpoint = (Highest(close, period) + Lowest(close, period)) / 2.0

See:
  - https://www.tradingtechnologies.com/xtrader-help/x-study/technical-indicator-definitions/midpoint-midpnt/


Aliases: MIDPOINT, MidPoint

Inputs: close

Outputs: midpoint

Params:
  - period (default: 14)
    Period to consider

midprice

Calculates the middle price of the highest high/lowest low across a period

Formula:
  - midprice = (Highest(high, period) + Lowest(low, period)) / 2.0

See:
  - https://www.tradingtechnologies.com/xtrader-help/x-study/technical-indicator-definitions/midprice-midpri/


Aliases: MIDPRICE, MidPrice

Inputs: high, low

Outputs: midprice

Params:
  - period (default: 14)
    Period to consider

sma

Non-weighted average of the last n periods

Formula:
  - movav = Sum(data, period) / period

See also:
  - http://en.wikipedia.org/wiki/Moving_average#Simple_moving_average


Aliases: SMA, SimpleMovingAverage

Inputs: close

Outputs: sma

Params:
  - period (default: 30)
    Period for the moving average calculation

smma

Smoothed Moving Average used by Wilder in his 1978 book `New Concepts in
Technical Trading`

Defined in his book originally as:

  - new_value = (old_value * (period - 1) + new_data) / period

Which is a moving average that smoothes data exponentially over time.

  - Exponential Smotthing factor: alpha = 1 / period

Formula
  - prev = mean(data, period)
  - movav = prev * (1.0 - alpha) + newdata * alpha
  - (or alternatively #  movav = prev + alpha(new - prev))

See also:
  - http://en.wikipedia.org/wiki/Moving_average#Modified_moving_average


Aliases: SMMA, SmoothedMovingAverage, MMA, ModifiedMovingAverage

Inputs: close

Outputs: smma

Params:
  - period (default: 30)
    Period for the moving average calculation
  - _seed (default: 0)
    Default to use average of periods as seed

t3

Described first by Tim Tillson in Stocks & Commodities V16:1, January 1998.

It first generalizes the DEMA by using a "volume" factor to put weight on
the 1st or 2nd factor of the DEMA to smooth the output.

And it then passes the input three times (hence T3) through the generalized
dema to reduce phase lag.

The default behavir implements the quadractic equation MetaStock version
presented in the article, which is also ta-lib compatible.

Using the paramter `_gd` one can enable the GeneralizedDema Triple Filter
formulation shown in the article (which is expanded to the quadratic
version) by the auther. The initial results are similar but not the
same. The results converge aftera number of bars (period dependent) to at
lest 6 decimals of precision (period 5 => after 71 bars)

See also:

  - https://www.fmlabs.com/reference/default.htm?url=T3.htm
  - http://www.tradingpedia.com/forex-trading-indicators/t3-moving-average-indicator/
  - https://www.tradingtechnologies.com/xtrader-help/x-study/technical-indicator-definitions/t3-t3/


Aliases: T3, TilsonsT3

Inputs: close

Outputs: t3

Params:
  - period (default: 5)
    Period to consider
  - vfactor (default: 0.7)
    Volume factor
  - _ma (default: ema)
    Moving Average to use
  - _gd (default: False)
    `True` use articl triple gd filter math formulation

tema

TEMA was first time introduced in 1994, in the article "Smoothing Data with
Faster Moving Averages" by Patrick G. Mulloy in "Technical Analysis of
Stocks & Commodities" magazine.

It attempts to reduce the inherent lag associated to Moving Averages

Formula:
  - ema1 = ema(data, period)
  - ema2 = ema(ema1, period)
  - ema3 = ema(ema2, period)
  - tema = 3 * ema1 - 3 * ema2 + ema3

See:
  - https://en.wikipedia.org/wiki/Triple_exponential_moving_average


Aliases: TEMA, TripleExponentialMovingAverage

Inputs: close

Outputs: tema

Params:
  - period (default: 30)
    Period to consider
  - _ma (default: ema)
    Moving Average to use

trima

The Triangular Moving Average (TRIMA) is an average of an average, similar
to the `sma` but placing more weight on the middle values due to the second
smoothing.

Formula:
  - if period is odd: p1 = p2 = (period + 1) // 2
  - if period is even: p1, p2 = (p // 2) + 1, p //2
  - trima = sma(sma(data, p2), p1)

See also:
  - https://www.tradingtechnologies.com/xtrader-help/x-study/technical-indicator-definitions/triangular-moving-average-trima/


Aliases: TRIMA, TriangularMovingAverage

Inputs: close

Outputs: trima

Params:
  - period (default: 30)
    Period for the moving average calculation
  - _ma (default: sma)
    Moving average to use

wma

A Moving Average which gives an arithmetic weighting to values with the
newest having the more weight

Formula:
  - weights = range(1, period + 1)
  - coef = 2 / (period * (period + 1))
  - movav = coef * Sum(weight[i] * data[period - i] for i in range(period))

See also:
  - http://en.wikipedia.org/wiki/Moving_average#Weighted_moving_average


Aliases: WMA, WeightedMovingAverage

Inputs: close

Outputs: wma

Params:
  - period (default: 30)
    Period for the moving average calculation
  - coef (default: 1.0)

Momentum

adx

Defined by J. Welles Wilder, Jr. in 1978 in his book *"New Concepts in
Technical Trading Systems"*.

Intended to measure trend strength and directionality

Formula:
  - upmove = high - high(-1)
  - downmove = low(-1) - low
  - +dm = upmove if upmove > downmove and upmove > 0 else 0
  - -dm = downmove if downmove > upmove and downmove > 0 else 0
  - +di = 100 * SmoothedAccum(+dm, period) / SmoothAccum(truerange, period)
  - -di = 100 * SmoothedAccum(-dm, period) / SmoothAccum(truerange, period)
  - dx = 100 * abs(+di - -di) / (+di + -di)
  - adx = MovingAverage(dx, period)

The moving average used is the one originally defined by Wilder,
the SmoothedMovingAverage

See also:
  - https://school.stockcharts.com/doku.php?id=technical_indicators:average_directional_index_adx
  - https://en.wikipedia.org/wiki/Average_directional_movement_index

Note:
  - The `_alt` parameter changes the formula to use the
    SmoothedMovingAverage in place of `SmoothAccum` as is interpreted by
    several alternative sources (which also effectively implies that
    `SmoothAccum(truerange, period) = ATR(high, low, close, period)`


Aliases: ADX, AverageDirectionalIndex, AVERAGEDIRECTIONALINDEX

Inputs: high, low, close

Outputs: adx

Params:
  - period (default: 14)
  - _period (default: 1)
  - _pearly (default: False)
  - _alt (default: False)
  - _accum (default: smacc)
  - _ma (default: smma)

TA-LIB (with compatibility flag "_talib=True"):

Increase period by 1, but keep 1-period early calculation from dm
intact

adxr

Defined by J. Welles Wilder, Jr. in 1978 in his book *"New Concepts in
Technical Trading Systems"*.

Intended to measure trend strength and directionality

Formula:
  - adxr = (adx - adx(-period)) / 2.0

See also:
  -


Aliases: ADXR, AverageDirectionalIndexRating

Inputs: high, low, close

Outputs: adxr

Params:
  - period (default: 14)
  - _period (default: 1)
  - _pearly (default: False)
  - _alt (default: False)
  - _accum (default: smacc)
  - _ma (default: smma)
  - _prating (default: None)
    Use as rating period instead of default period

TA-LIB (with compatibility flag "_talib=True"):

ta-lib uses period - 1 for the adxr formula when summing the current
adx and the adx from `period` ago

apo

Shows the difference between a short and long exponential moving
averages expressed in points, unlike the `ppo` which does in percent values

Formula:
  - apo = ema(data, pfast) - ema(data, pslow)

See:
  - http://www.metastock.com/Customer/Resources/TAAZ/?c=3&p=94
  - https://www.tradingtechnologies.com/xtrader-help/x-study/technical-indicator-definitions/absolute-price-oscillator-apo/


Aliases: APO, AbsolutePriceOscillator, PriceOscillator

Inputs: close

Outputs: apo

Params:
  - pfast (default: 12)
  - pslow (default: 26)
  - _ma (default: ema)

TA-LIB (with compatibility flag "_talib=True"):

Set moving average to sma instead of ema

aroon

Developed by Tushar Chande in 1995.

It tries to determine if a trend exists or not by calculating how far away
within a given period the last highs/lows are (AroonUp/AroonDown)

Formula:
  - up = 100 * (period - distance to highest high) / period
  - down = 100 * (period - distance to lowest low) / period

Note:
  The lines oscillate between 0 and 100. That means that the "distance" to
  the last highest or lowest must go from 0 to period so that the formula
  can yield 0 and 100.

  Hence the lookback period is period + 1, because the current bar is also
  taken into account. And therefore this indicator needs an effective
  lookback period of period + 1.

See:
  - http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:aroon


Aliases: AROON, Aroon

Inputs: high, low

Outputs: aroondn, aroonup

Params:
  - period (default: 14)

aroonosc

It is a variation of the AroonUpDown indicator which shows the current
difference between the AroonUp and AroonDown value, trying to present a
visualization which indicates which is stronger (greater than 0 -> AroonUp
and less than 0 -> AroonDown)

Formula:
  - aroonosc = aroonup - aroondn

See:
  - http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:aroon


Aliases: AROONOSC, AroonOscillator

Inputs: high, low

Outputs: aroonosc

Params:
  - period (default: 14)

bop

Bop tries to determine the power of buyers vs sellers, by calculating the
power of being able to take the price to the extremes.

Igor Livshin introduced in August 2001 in the Stocks and Commodities
Magazine

Formula:
  - bop = (close - open) / (high - low)

See also:
  - https://www.interactivebrokers.com/en/software/tws/usersguidebook/technicalanalytics/balancePower.htm
  - https://www.marketvolume.com/technicalanalysis/balanceofpower.asp


Aliases: BOP, BalanceOfPower

Inputs: open, high, low, close

Outputs: bop

cci

Introduced by Donald Lambert in 1980 to measure variations of the
"typical price" (see below) from its mean to identify extremes and
reversals

Formula:
  - tp = typical_price = (high + low + close) / 3
  - tpmean = MovingAverage(tp, period)
  - deviation = tp - tpmean
  - meandev = MeanDeviation(tp)
  - cci = deviation / (meandeviation * factor)

See:
  - https://en.wikipedia.org/wiki/Commodity_channel_index


Aliases: CCI, CommodityChannelIndex

Inputs: high, low, close

Outputs: cci

Params:
  - period (default: 20)
    Period to consider
  - factor (default: 0.015)
    Channel width factor
  - _ma (default: sma)
    Moving Average to sue
  - _dev (default: mad)
    Deviation to use (Def: Mean Abs Dev)

TA-LIB (with compatibility flag "_talib=True"):

Change period to 14

di

Defined by J. Welles Wilder, Jr. in 1978 in his book *"New Concepts in
Technical Trading Systems"*.

Intended to measure trend strength and directionality

Formula:
  - upmove = high - high(-1)
  - downmove = low(-1) - low
  - +dm = upmove if upmove > downmove and upmove > 0 else 0
  - -dm = downmove if downmove > upmove and downmove > 0 else 0
  - +di = 100 * SmoothedAccum(+dm, period) / SmoothAccum(truerange, period)
  - -di = 100 * SmoothedAccum(-dm, period) / SmoothAccum(truerange, period)

See also:
  - https://school.stockcharts.com/doku.php?id=technical_indicators:average_directional_index_adx
  - https://en.wikipedia.org/wiki/Average_directional_movement_index

Note:
  - The `_alt` parameter changes the formula to use the
    SmoothedMovingAverage in place of `SmoothAccum` as is interpreted by
    several alternative sources (which also effectively implies that
    `SmoothAccum(truerange, period) = ATR(high, low, close, period)`


Aliases: DI, DirectionalIndicator, DIRECTIONALINDICATOR

Inputs: high, low, close

Outputs: plusdi, minusdi

Params:
  - period (default: 14)
  - _period (default: 1)
  - _pearly (default: False)
  - _alt (default: False)
  - _accum (default: smacc)
  - _ma (default: smma)

TA-LIB (with compatibility flag "_talib=True"):

Increase period by 1, but keep 1-period early calculation from dm
intact

dm

Defined by J. Welles Wilder, Jr. in 1978 in his book *"New Concepts in
Technical Trading Systems"*.

Intended to measure trend strength and directionality

Formula:
  - upmove = high - high(-1)
  - downmove = low(-1) - low
  - +dm1 = upmove if upmove > downmove and upmove > 0 else 0
  - -dm1 = downmove if downmove > upmove and downmove > 0 else 0
  - +dm = SmoothAccum(+dm1, period)
  - -dm = SmoothAccum(-dm1, period)

See also:
  - https://school.stockcharts.com/doku.php?id=technical_indicators:average_directional_index_adx
  - https://en.wikipedia.org/wiki/Average_directional_movement_index

Note:
  - Although the original definition from Welles Wilder for DirectionalMove
    does not imply a period, `ta-lib` defines `plus_dm` (+dm) and
    `minus_dm` (-dm) with a period over which they are accumulted. The
    accumulation was defined within the scope of the `DirectionalIndicator`
    (+di, -di) definition.


Aliases: DM, DirectionalMovement

Inputs: high, low

Outputs: plusdm, minusdm

Params:
  - period (default: 14)
  - _period (default: 1)
  - _pearly (default: False)
  - _alt (default: False)
  - _accum (default: smacc)
  - _ma (default: smma)

TA-LIB (with compatibility flag "_talib=True"):

Calculate seed 1-period too early and therefore deliver one period
too early

dx

Defined by J. Welles Wilder, Jr. in 1978 in his book *"New Concepts in
Technical Trading Systems"*.

Intended to measure trend strength and directionality

Formula:
  - upmove = high - high(-1)
  - downmove = low(-1) - low
  - +dm = upmove if upmove > downmove and upmove > 0 else 0
  - -dm = downmove if downmove > upmove and downmove > 0 else 0
  - +di = 100 * SmoothedAccum(+dm, period) / SmoothAccum(truerange, period)
  - -di = 100 * SmoothedAccum(-dm, period) / SmoothAccum(truerange, period)
  - dx = 100 * abs(+di - -di) / (+di + -di)

See also:
  - https://school.stockcharts.com/doku.php?id=technical_indicators:average_directional_index_adx
  - https://en.wikipedia.org/wiki/Average_directional_movement_index

Note:
  - The `_alt` parameter changes the formula to use the
    SmoothedMovingAverage in place of `SmoothAccum` as is interpreted by
    several alternative sources (which also effectively implies that
    `SmoothAccum(truerange, period) = ATR(high, low, close, period)`


Aliases: DX, DirectionalIndex, DIRECTIONALINDEX

Inputs: high, low, close

Outputs: dx

Params:
  - period (default: 14)
  - _period (default: 1)
  - _pearly (default: False)
  - _alt (default: False)
  - _accum (default: smacc)
  - _ma (default: smma)

TA-LIB (with compatibility flag "_talib=True"):

Increase period by 1, but keep 1-period early calculation from dm
intact

macd

Moving Average Convergence Divergence. Defined by Gerald Appel in the 70s.

It measures the distance of a fast and a slow moving average to try to
identify the trend.

A second lagging moving average over the convergence-divergence should
provide a "signal" upon being crossed by the macd

Formula:
  - macd = ma(data, pfast) - ma(data, pslow)
  - signal = ma(macd, psignal)
  - histogram = macd - signal

See:
  - http://en.wikipedia.org/wiki/MACD


Aliases: MACD, MovingAverageConvergenceDivergence, MACDEXT, MACDFIX

Inputs: close

Outputs: macd, signal, histogram

Params:
  - pfast (default: 12)
    Fast moving average period
  - pslow (default: 26)
    Slow moving average period
  - psignal (default: 9)
    Signal smoothing period
  - _ma (default: ema)
    Moving average to use
  - _masig (default: None)
    Signal moving average (if `None`, same as others)

TA-LIB (with compatibility flag "_talib=True"):

Start fast ema calc delivery at the offset of the slow ema

mfi

Created by Gene Quong and Avrum Soudack to identify buying/selling
pressure by combining price and volume in the calculation.

Pressure is positive if the (typical) price increases and negative if it
decreases. The volume is the weight factor for how much pressure is being
exercised on the asset.

Formula:
  - tp = typical_price = (high + low + close) / 3
  - money_flow_raw = tp * volume
  - flow_positive = Sum(money_flow_raw * (tp > tp(-1)), period)
  - flow_netagive = Sum(money_flow_raw * (tp < tp(-1)), period)
  - money_flow_ratio = flow_positive / flow_negative
  - mfi  100 - 100 / (1 + money_flow_ratio)

See:
  - https://school.stockcharts.com/doku.php?id=technical_indicators:money_flow_index_mfi
  - https://www.investopedia.com/terms/m/mfi.asp


Aliases: MFI, MoneyFlowIndicator

Inputs: high, low, close, volume

Outputs: mfi

Params:
  - period (default: 14)
    Period to consider

minus_di

Defined by J. Welles Wilder, Jr. in 1978 in his book *"New Concepts in
Technical Trading Systems"*.

Intended to measure trend strength and directionality

Formula:
  - upmove = high - high(-1)
  - downmove = low(-1) - low
  - -dm = downmove if downmove > upmove and downmove > 0 else 0
  - -di = 100 * SmoothedAccum(-dm, period) / SmoothAccum(truerange, period)

See also:
  - https://school.stockcharts.com/doku.php?id=technical_indicators:average_directional_index_adx
  - https://en.wikipedia.org/wiki/Average_directional_movement_index

Note:
  - The `_alt` parameter changes the formula to use the
    SmoothedMovingAverage in place of `SmoothAccum` as is interpreted by
    several alternative sources (which also effectively implies that
    `SmoothAccum(truerange, period) = ATR(high, low, close, period)`


Aliases: MINUS_DI, MinusDirectionalIndicator

Inputs: high, low, close

Outputs: minusdi

Params:
  - period (default: 14)
  - _period (default: 1)
  - _pearly (default: False)
  - _alt (default: False)
  - _accum (default: smacc)
  - _ma (default: smma)

TA-LIB (with compatibility flag "_talib=True"):

Increase period by 1, but keep 1-period early calculation from dm
intact

minus_dm

Defined by J. Welles Wilder, Jr. in 1978 in his book *"New Concepts in
Technical Trading Systems"*.

Intended to measure trend strength and directionality

Formula:
  - upmove = high - high(-1)
  - downmove = low(-1) - low
  - -dm1 = downmove if downmove > upmove and downmove > 0 else 0
  - -dm = SmoothAccum(-dm1, period)

See also:
  - https://school.stockcharts.com/doku.php?id=technical_indicators:average_directional_index_adx
  - https://en.wikipedia.org/wiki/Average_directional_movement_index

Note:
  - Although the original definition from Welles Wilder for DirectionalMove
    does not imply a period, `ta-lib` defines `plus_dm` (+dm) and
    `minus_dm` (-dm) with a period over which they are accumulted. The
    accumulation was defined within the scope of the `DirectionalIndicator`
    (+di, -di) definition.



Aliases: MINUS_DM, MinusDirectionalMovement

Inputs: high, low

Outputs: minusdm

Params:
  - period (default: 14)
  - _period (default: 1)
  - _pearly (default: False)
  - _alt (default: False)
  - _accum (default: smacc)
  - _ma (default: smma)

TA-LIB (with compatibility flag "_talib=True"):

Calculate seed 1-period too early and therefore deliver one period
too early

plus_di

Defined by J. Welles Wilder, Jr. in 1978 in his book *"New Concepts in
Technical Trading Systems"*.

Intended to measure trend strength and directionality

Formula:
  - upmove = high - high(-1)
  - downmove = low(-1) - low
  - +dm = upmove if upmove > downmove and upmove > 0 else 0
  - +di = 100 * SmoothedAccum(+dm, period) / SmoothAccum(truerange, period)

See also:
  - https://school.stockcharts.com/doku.php?id=technical_indicators:average_directional_index_adx
  - https://en.wikipedia.org/wiki/Average_directional_movement_index

Note:
  - The `_alt` parameter changes the formula to use the
    SmoothedMovingAverage in place of `SmoothAccum` as is interpreted by
    several alternative sources (which also effectively implies that
    `SmoothAccum(truerange, period) = ATR(high, low, close, period)`


Aliases: PLUS_DI, PlusDirectionalIndicator

Inputs: high, low, close

Outputs: plusdi

Params:
  - period (default: 14)
  - _period (default: 1)
  - _pearly (default: False)
  - _alt (default: False)
  - _accum (default: smacc)
  - _ma (default: smma)

TA-LIB (with compatibility flag "_talib=True"):

Increase period by 1, but keep 1-period early calculation from dm
intact

plus_dm

Defined by J. Welles Wilder, Jr. in 1978 in his book *"New Concepts in
Technical Trading Systems"*.

Intended to measure trend strength and directionality

Formula:
  - upmove = high - high(-1)
  - downmove = low(-1) - low
  - +dm1 = upmove if upmove > downmove and upmove > 0 else 0
  - +dm = SmoothAccum(+dm1, period)

See also:
  - https://school.stockcharts.com/doku.php?id=technical_indicators:average_directional_index_adx
  - https://en.wikipedia.org/wiki/Average_directional_movement_index

Note:
  - Although the original definition from Welles Wilder for DirectionalMove
    does not imply a period, `ta-lib` defines `plus_dm` (+dm) and
    `minus_dm` (-dm) with a period over which they are accumulted. The
    accumulation was defined within the scope of the `DirectionalIndicator`
    (+di, -di) definition.


Aliases: PLUS_DM, PlusDirectionalMovement

Inputs: high, low

Outputs: plusdm

Params:
  - period (default: 14)
  - _period (default: 1)
  - _pearly (default: False)
  - _alt (default: False)
  - _accum (default: smacc)
  - _ma (default: smma)

TA-LIB (with compatibility flag "_talib=True"):

Calculate seed 1-period too early and therefore deliver one period
too early

ppo

Shows the difference between a fast and slow exponential moving
averages expressed in percentage. The MACD does the same but expressed in
absolute points.

Expressing the difference in percentage allows to compare the indicator at
different points in time when the underlying value has significatnly
different values.

Formula:
  - ppo = 100.0 * (ema(data, pfast)/ema(data, pslow) - 1.0)

See:
  - http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:price_oscillators_ppo


Aliases: PPO, PercentagePriceOscillator

Inputs: close

Outputs: ppo, signal, histogram

Params:
  - pfast (default: 12)
  - pslow (default: 26)
  - _ma (default: ema)
  - psignal (default: 9)
    Signal smoothing period
  - _masig (default: None)
    Signal moving average (if `None`, same as others)

TA-LIB (with compatibility flag "_talib=True"):

Set moving average to sma instead of ema

ppofast

Shows the difference between a fast and slow exponential moving
averages expressed in percentage. The MACD does the same but expressed in
absolute points.

Expressing the difference in percentage allows to compare the indicator at
different points in time when the underlying value has significatnly
different values.

Most on-line literature shows the percentage calculation having the long
exponential moving average as the denominator. Some sources like MetaStock
use the fast one.

Formula:
  - ppo = 100.0 *  (1.0 - ema(data, pslow) / ema(data, pshort))
  - Alternative = ppo = 100.0 - 100.0 * (ema_slow / ema_fast)

See:
  - http://www.metastock.com/Customer/Resources/TAAZ/?c=3&p=94


Aliases: PPOFast, PercentagePriceOscillatorFast

Inputs: close

Outputs: ppo, signal, histogram

Params:
  - pfast (default: 12)
  - pslow (default: 26)
  - _ma (default: ema)
  - psignal (default: 9)
    Signal smoothing period
  - _masig (default: None)
    Signal moving average (if `None`, same as others)

TA-LIB (with compatibility flag "_talib=True"):

Set moving average to sma instead of ema

roc

The ROC calculation compares the current price with the price n periods
ago, to determine momentum the as the percent change in price. This version
scales the percentage to 100.

  - roc = 100.0 * (data / data(-period) - 1.0)

See:
  - https://school.stockcharts.com/doku.php?id=technical_indicators:rate_of_change_roc_and_momentum



Aliases: rateofchange, ROC, RateOfChange

Inputs: close

Outputs: roc

Params:
  - period (default: 12)

TA-LIB (with compatibility flag "_talib=True"):

Change period to 10

rocp

The ROC calculation compares the current price with the price n periods
ago, to determine momentum the as the percent change in price.

Formula:

  - rocp = data / data(-period) - 1.0

See:
  - https://school.stockcharts.com/doku.php?id=technical_indicators:rate_of_change_roc_and_momentum


Aliases: ROCP, RateOfChangePercentage

Inputs: close

Outputs: rocp

Params:
  - period (default: 12)

TA-LIB (with compatibility flag "_talib=True"):

Change period to 10

rocr

The ROCR calculation compares the current price with the price n periods
ago as a ratio to determine momentum.

Formula:

  - rocr = data / data(-period)

See:
  - https://school.stockcharts.com/doku.php?id=technical_indicators:rate_of_change_roc_and_momentum


Aliases: ROCR, RateOfChangeRatio

Inputs: close

Outputs: rocr

Params:
  - period (default: 12)

TA-LIB (with compatibility flag "_talib=True"):

Change period to 10

rocr100

The ROCR calculation compares the current price with the price n periods
ago as a ratio to determine momentum, scaled to 100.

Formula:

  - rocr100 = 100.0 * data / data(-period)

See:
  - https://school.stockcharts.com/doku.php?id=technical_indicators:rate_of_change_roc_and_momentum


Aliases: ROCR100, RateOfChangeRatio100

Inputs: close

Outputs: rocr100

Params:
  - period (default: 12)

TA-LIB (with compatibility flag "_talib=True"):

Change period to 10

rsi

Defined by J. Welles Wilder, Jr. in 1978 in his book *"New Concepts in
Technical Trading Systems"*.

It measures momentum by calculating the ration of higher closes and
lower closes after having been smoothed by an average, normalizing
the result between 0 and 100

Formula:
  - up = upday(data)  # max(close - close(-1), 0.0)
  - down = downday(data)  # abs( min(close - close(-1), 0.0) )
  - maup = movingaverage(up, period)
  - madown = movingaverage(down, period)
  - rs = maup / madown
  - rsi = 100 - 100 / (1 + rs)

The moving average used is the one originally defined by Wilder,
the SmoothedMovingAverage

See:
  - http://en.wikipedia.org/wiki/Relative_strength_index


Aliases: RSI, RelativeStrengthIndex

Inputs: close

Outputs: rsi

Params:
  - period (default: 14)
    Period to consider
  - lookback (default: 1)
    Lookback for up/down days
  - _ma (default: smma)
    Smoothing moving average

sar

Defined by J. Welles Wilder, Jr. in 1978 in his book *"New Concepts in
Technical Trading Systems"* for the RSI

SAR stands for *Stop and Reverse* and the indicator was meant as a signal
for entry (and reverse)

How to select the 1st signal is left unspecified in the book. Because the
inputs are "high" and "low", a 1-bar MinusDM is calculated, which accounts
for both downmove and upmove of high/low. This is also done by ta-lib

See:
  - https://en.wikipedia.org/wiki/Parabolic_SAR
  - http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:parabolic_sar


Aliases: SAR, psar, ParabolicStopAndReverse

Inputs: high, low

Outputs: sar

Params:
  - af (default: 0.02)
    Acceleration Factor
  - afmax (default: 0.2)
    Maximum Acceleration Factor

sarext

Defined by J. Welles Wilder, Jr. in 1978 in his book *"New Concepts in
Technical Trading Systems"* for the RSI

SAR stands for *Stop and Reverse* and the indicator was meant as a signal
for entry (and reverse)

How to select the 1st signal is left unspecified in the book. Because the
inputs are "high" and "low", a 1-bar MinusDM is calculated, which accounts
for both downmove and upmove of high/low. This is also done by ta-lib

Compared to the standard `sar`, one can define the initial trend, the value
of the initial `sar`, different acceleration factors for long and short,
and an offset to be applied to the sar when the trend is reversed

See:
  - https://en.wikipedia.org/wiki/Parabolic_SAR
  - http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:parabolic_sar


Aliases: SAR, psar, ParabolicStopAndReverse

Inputs: high, low

Outputs: sar

Params:
  - startval (default: 0)
    Start trend (0 auto, 1 long, -1 short)
  - aflong (default: 0.02)
    Acceleration Factor (Long)
  - afmaxlong (default: 0.2)
    Maximum Acceleration Factor (Long)
  - afshort (default: 0.02)
    Acceleration Factor (Long)
  - afmaxshort (default: 0.2)
    Maximum Acceleration Factor (Long)
  - offsetonreverse (default: 0.0)
    Offset to apply when reversing position

stochastic

By Dr. George Lane in the 50s. It compares a closing price to the price
range and tries to show convergence if the closing prices are close to the
extremes

  - It will go up if closing prices are close to the highs
  - It will go down if closing prices are close to the lows

It shows divergence if the extremes keep on growing/decreasing but closing
prices do not in the same manner (distance to the extremes increases)

Formula:
  - hh = highest(high, period)
  - ll = lowest(low, period)
  - kfast = 100 * (close - ll) / (hh - ll)
  - k = MovingAverage(kfast, pfast)
  - d = MovingAverage(k, pslow)

See:
  - http://en.wikipedia.org/wiki/Stochastic_oscillator


Aliases: stoch, Stochastic, STOCHASTIC, STOCH

Inputs: high, low, close

Outputs: k, d

Params:
  - period (default: 14)
  - pfast (default: 3)
  - _ma (default: sma)
  - pslow (default: 3)
    Slow moving average period
  - _maslow (default: None)
    Slow moving average (if `None`, use same as fast)

TA-LIB (with compatibility flag "_talib=True"):

Change period to 5

stochf

By Dr. George Lane in the 50s. It compares a closing price to the price
range and tries to show convergence if the closing prices are close to the
extremes

  - It will go up if closing prices are close to the highs
  - It will go down if closing prices are close to the lows

It shows divergence if the extremes keep on growing/decreasing but closing
prices do not in the same manner (distance to the extremes increases)

Formula:
  - hh = highest(high, period)
  - ll = lowest(low, period)
  - kfast = 100 * (close - ll) / (hh - ll)
  - dfast = MovingAverage(kfast, pfast)

See:
  - http://en.wikipedia.org/wiki/Stochastic_oscillator


Aliases: stochfast, StochasticFast, STOCHF

Inputs: high, low, close

Outputs: k, d

Params:
  - period (default: 14)
    Period to consider
  - pfast (default: 3)
    Fast smoothing period
  - _ma (default: sma)
    Moving average to use

TA-LIB (with compatibility flag "_talib=True"):

Change period to 5

stochrsi

Presented by Chande and Kroll the 1990 book: "The New Technical Trader".
The RSI is fed into a atochastic-like calculation to increase its
sensitivity.

The recommendation is to keep the period for looking for highest highes and
lowest lows the same as the for the RSI, but it can be played with for
experimentation.

Scaling to 100 is also suggested as a possiblity (the range is 0.0 => 1.0)

Formula:

  - rsi = RSI(data, period)
  - maxrsi = Highest(rsi, period)
  - minrsi = Lowest(rsi, period)

  - stochrsi = (rsi - minrsi) / (maxrsi - minrsi)

See
  - https://school.stockcharts.com/doku.php?id=technical_indicators:stochrsi


Aliases: StochRsi, STOCHRSI

Inputs: close

Outputs: stochrsi

Params:
  - period (default: 14)
    Period to consider
  - _philo (default: None)
    Period for highest/lowest (None => period)
  - _scale (default: 1.0)
    Scale the result by this factor

TA-LIB (with compatibility flag "_talib=True"):


ta-lib uses internally the fast stochastic to calculate the stochrsi,
with these side-effects

  - The scale changes from 0.0-1.0 to 0.0-100.0

  - A 2nd output is returned (stochrsi as defined by its authors has
    only 1 output)

  - The highest/lowest period is no longer symmetric with the rsi
    period

Compatibility does this
  - Change the scale to 0.0-100.0
  - Change the highest/lowest period 5
  - Add a 2nd output named 'd' (as the 2nd output of the stochastic)
  - Run a simple moving average on it of period 3

trix

Defined by Jack Hutson in the 80s and shows the Rate of Change (%) or slope
of a triple exponentially smoothed moving average

Formula:
  - ema1 = EMA(data, period)
  - ema2 = EMA(ema1, period)
  - ema3 = EMA(ema2, period)
  - trix = 100 * (ema3 / ema3(1) - 1)
    Where -1 is the lookback period to consider the rate of change

  The final formula can be simplified to: 100 * (ema3 / ema3(-1) - 1)

The moving average used is the one originally defined by Wilder,
the SmoothedMovingAverage

See:
  - https://en.wikipedia.org/wiki/Trix_(technical_analysis)
  - http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:trix


Aliases: Trix, TRIX

Inputs: close

Outputs: trix

Params:
  - period (default: 30)
    Period to consider
  - _ma (default: ema)
    Moving average to use

ultimateoscillator

Developed by Larry Williams. It is based on notion of buying or selling
pressure by considering where where a the closing price is within the true
range.

Formula (default values):
  - bp = close - truelow(low, close)  # buying pressure
  - tr = truerange(high, low, close)
  - av7 = Sum(bp, 7) / Sum(tr, 7)
  - av14 = Sum(bp, 14) / Sum(tr, 14)
  - av28= Sum(bp, 28) / Sum(tr, 28)
  - uo = 100 * (4*av7 + 2*av14 + av18) / (4 + 2 + 1)

See:
  - https://en.wikipedia.org/wiki/Ultimate_oscillator
  - http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:ultimate_oscillator


Aliases: ultosc, UltimateOscillator, ULTOSC

Inputs: high, low, close

Outputs: uo

Params:
  - period1 (default: 7)
    Faster oscillating period
  - period2 (default: 14)
    Medium oscillating period
  - period3 (default: 28)
    Slower oscillating period
  - factor1 (default: 4.0)
    Factor weight for the faster oscillation
  - factor2 (default: 2.0)
    Factor weight for the medium oscillation
  - factor3 (default: 1.0)
    Factor weight for the slower oscillation

williamsr

Developed by Larry Williams to show the relation of closing prices to
the highest-lowest range of a given period.

Known as Williams %R (but % is not allowed in Python identifiers)

Formula:
  - num = highest(high, period) - close
  - den = highest(high, period) - lowest(low, period)
  -  %R = -100.0 * (num / den)

See:
  - http://en.wikipedia.org/wiki/Williams_%25R
  - https://school.stockcharts.com/doku.php?id=technical_indicators:williams_r


Aliases: willr, WilliamsR, WILLIAMSR, WILLR

Inputs: high, low, close

Outputs: r

Params:
  - period (default: 14)
    Period to consider

Volume

Originally the "Cumulative Money Flow Line" by Mark Chaikin, which attempts
to measure the incoming and outgoing flow of money by using the volume in
addition the standard price components.

Formula:
  - mfm = ((close - high) + (close - low)) / (high - low)
    - ergo: mfm = (2*close - high - low) / (high - low)

  - mfv = mf * volume
  - ad = cumulative_sum(mvf)

See also:
  - https://en.wikipedia.org/wiki/Accumulation/distribution_index
  - https://school.stockcharts.com/doku.php?id=technical_indicators:accumulation_distribution_line


Aliases: AD, adl, ADL, ChaikinAD, ChaikinADL, chaikinad

Inputs: high, low, close, volume

Outputs: ad

adosc

The Chaikin Oscillator applies a `MACD` formula to the
Accumulation/Distribution Line (`ad`) to calculate the momentum of the
money flow.

See also:
  - https://en.wikipedia.org/wiki/Chaikin_Analytics#Chaikin_Oscillator
  - https://school.stockcharts.com/doku.php?id=technical_indicators:chaikin_oscillator
  - https://www.metastock.com/customer/resources/taaz/?p=41


Aliases: ADOSC, ChaikinADOSC, ChaikinOsc, ChaikinOscillator

Inputs: high, low, close, volume

Outputs: adosc

Params:
  - pfast (default: 3)
    Fast ema period
  - pslow (default: 10)
    Slow ema period
  - _ma (default: ema)
    Moving average to use

TA-LIB (with compatibility flag "_talib=True"):

Switch to `ewma` (i.e.: *exponential weighted moving mean* with no seed
instead of using a standard `ema` exponential moving average

obv

Originally called "continuous volume" by Woods and Vignola, it was later
named "on-balance volume" by Joseph Granville in his 1963 book Granville's
New Key to Stock Market Profits.

On Balance Volume (OBV) measures buying and selling pressure as a
cumulative indicator, adding volume on up days and subtracting it on down
days.

Formula:
  - close > close(-1) => vol_pressure = +volume
  - close < close(-1) => vol_pressure = -volume
  - close == close(-1) => vol_pressure = 0

  - obv = obv(-1) + vol_pressure

See also:
  - https://en.wikipedia.org/wiki/On-balance_volume
  - https://www.investopedia.com/terms/o/onbalancevolume.asp
  - https://school.stockcharts.com/doku.php?id=technical_indicators:on_balance_volume_obv


Aliases: OBV, OnBalanceVolume

Inputs: close, volume

Outputs: obv

Params:
  - _period (default: 1)
    Period for `close` comparison

TA-LIB (with compatibility flag "_talib=True"):

Use first day volume as *positive* seed value

Volatility

atr

Defined by J. Welles Wilder, Jr. in 1978 in his book *"New Concepts in
Technical Trading Systems"*.

The idea is to take the close into account to calculate the range if it
yields a larger range than the daily range (High - Low)

Formula:
  - truerange = max(high, close(-1)) - min(low, close(-1))
  - atr = SmoothedMovingAverage(truerange, period)

See:
  - http://en.wikipedia.org/wiki/Average_true_range


Aliases: ATR, AverageTrueRange

Inputs: high, low, close

Outputs: atr

Params:
  - _period (default: 1)
  - period (default: 14)
    Period to consider
  - _ma (default: smma)
    Moving average to use

natr

Offers a normalized (against the `close`) version of the `atr`, which can
provide better values for comparison against different price ranges.

Formula:
  - natr = 100.0 * atr / close

See:
  - http://en.wikipedia.org/wiki/Average_true_range


Aliases: NATR, NormalizedAverageTrueRange

Inputs: high, low, close

Outputs: natr

Params:
  - _period (default: 1)
  - period (default: 14)
  - _ma (default: smma)

truehigh

Defined by J. Welles Wilder, Jr. in 1978 in his book *"New Concepts in
Technical Trading Systems"* for the ATR

Records the "true high" which is the maximum of today's high and
yesterday's close

Formula:
  - truehigh = max(high, close_prev)

See:
  - http://en.wikipedia.org/wiki/Average_true_range


Aliases: TR, TrueRange, trange, TRANGE

Inputs: low, close

Outputs: truehi

Params:
  - _period (default: 1)
    Period to consider

truelow

Defined by J. Welles Wilder, Jr. in 1978 in his book *"New Concepts in
Technical Trading Systems"* for the ATR

Records the "true low" which is the minimum of today's low and
yesterday's close

Formula:
  - truelow = min(low, close_prev)

See:
  - http://en.wikipedia.org/wiki/Average_true_range


Aliases: TR, TrueRange, trange, TRANGE

Inputs: low, close

Outputs: truelo

Params:
  - _period (default: 1)
    Period to consider

truerange

Defined by J. Welles Wilder, Jr. in 1978 in his book New Concepts in
Technical Trading Systems.

Formula:
  - max(high - low, abs(high - prev_close), abs(prev_close - low)

  which can be simplified to

  - truerange = max(high, prev_close) - min(low, prev_close)

See:
  - http://en.wikipedia.org/wiki/Average_true_range

The idea is to take the previous close into account to calculate the range
if it yields a larger range than the daily range (High - Low)


Aliases: TR, TrueRange, trange, TRANGE

Inputs: high, low, close

Outputs: tr

Params:
  - _period (default: 1)
    Period for high/low vs close for truerange calc

Price Transform

avgprice

Returns the average of the 4 OHLC price components

Formula:
  - avg = (open + high + low + close) / 3

See:
  - (None)


Aliases: AvgPrice, AveragePrice, AVGPrice, AVGPRICE

Inputs: open, high, low, close

Outputs: avg

Params:
  - divisor (default: 4.0)
    Factor to use in the division

medprice

Delivers the Median Price

Formula:
  - med = (high + low) / 2.0

See:
  - https://www.metastock.com/customer/resources/taaz/?p=70


Aliases: WCLPrice, WeightedClosePrice, WCLPRICE, weightedcloseprice

Inputs: high, low

Outputs: med

Params:
  - divisor (default: 2.0)
    Factor to use in the division

typprice

Delivers the typical price

Formula:
  - tp = (high + low + close) / 3

See:
  - https://en.wikipedia.org/wiki/Typical_price


Aliases: typicalprice, TypicalPrice, TypPrice, TYPPRICE

Inputs: high, low, close

Outputs: tp

Params:
  - divisor (default: 3.0)
    Factor to use in the division

wclprice

Delivers the Weighted Close Price

Formula:
  - wcl = (high + low + close * 2) / 4

See:
  - https://www.metastock.com/customer/resources/taaz/?p=124
  - http://www.ta-guru.com/Book/TechnicalAnalysis/TechnicalIndicators/WeightedClose.php5


Aliases: WCLPrice, WeightedClosePrice, WCLPRICE, weightedcloseprice

Inputs: high, low, close

Outputs: wcl

Params:
  - weight (default: 2.0)
    Weight Factor for close
  - divisor (default: 4.0)
    Factor to use in the division

Cycle

ht_dcperiod

Ehlers': Hilber Transform Dominant Cycle Period

Formula:
  - From *"Rocket Science for Traders: Digital Signal Processing Applications"*

See:
  - https://www.amazon.com/Rocket-Science-Traders-Processing-Applications/dp/0471405671


Aliases: HT_DCPERIOD, HilberTransform_DominantCyclePeriod

Inputs: high, low

Outputs: dcperiod

ht_dcphase

Ehlers': Hilber Transform Dominant Cycle Phase

Formula:
  - From *"Rocket Science for Traders: Digital Signal Processing Applications"*

See:
  - https://www.amazon.com/Rocket-Science-Traders-Processing-Applications/dp/0471405671


Aliases: HT_DCPHASE, HilberTransform_DominantCyclePhase

Inputs: high, low

Outputs: dcphase

ht_phasor

Ehlers': Hilbert Transform Phasor

Formula:
  - From *"Rocket Science for Traders: Digital Signal Processing Applications"*

See:
  - https://www.amazon.com/Rocket-Science-Traders-Processing-Applications/dp/0471405671


Aliases: HT_PHASOR, HilberTransform_Phasor

Inputs: high, low

Outputs: inphase, quadrature

ht_sine

Ehlers': Hilber Transform Sine

Formula:
  - From *"Rocket Science for Traders: Digital Signal Processing Applications"*

See:
  - https://www.amazon.com/Rocket-Science-Traders-Processing-Applications/dp/0471405671


Aliases: HT_SINE, HilberTransform_Sine

Inputs: high, low

Outputs: sine, leadsine

ht_trendmode

Ehlers': Hilber Transform Trend Mode

Formula:
  - From *"Rocket Science for Traders: Digital Signal Processing Applications"*

See:
  - https://www.amazon.com/Rocket-Science-Traders-Processing-Applications/dp/0471405671


Aliases: HT_TRENDMODE, HilberTransform_Trendmode

Inputs: high, low

Outputs: trendline

Statistic

beta

The description of the algorithm has been adapted from `ta-lib`

The Beta 'algorithm' is a measure of a stocks volatility vs from index. The
stock prices are given as the 1st input and the index prices are given in
the 2nd input. The size of the inputs should be equal. The algorithm is to
calculate the change between prices in both inputs and then 'plot' these
changes are points in the Euclidean plane. The x value of the point is
market return and the y value is the security return. The beta value is the
slope of a linear regression through these points. A beta of 1.0 is simple
the line y=x, so the stock varies precisely with the market. A beta of less
than 1.0 means the stock varies less thandd the market and a beta of more
than 1.0 means the stock varies more than market.

See:
  - http://www.moneychimp.com/articles/risk/regression.htm


Aliases: BETA, Beta

Inputs: asset, market

Outputs: beta

Params:
  - period (default: 5)
    Period to consider
  - _prets (default: 1)
    Lookback period to calculate the returns
  - _rets (default: True)
    Calculate beta on returns

correl

Rolling Pearson correlation of the two inputs `asset1` and `asset2`

Note: the default inputs are named `high` and `low` to ensure an easy match
with a multiple input (dataframe). But they can be anything

See:
  - https://en.wikipedia.org/wiki/Pearson_correlation_coefficient


Aliases: CORREL, Correl

Inputs: high, low

Outputs: correl

Params:
  - period (default: 30)
    Period to consider
  - _prets (default: 1)
    Lookback period to calculate the returns
  - _rets (default: True)
    Calculate beta on returns

linearreg

Linear Regression of the values of an asset (y-axis) along the "x" (period
window, x-axix) using the least squares method to find the best fit.

Formula:
  - y = b + m * x

**This indicator returns: "b + m * x" (using x = period - 1)**

See:
  - https://en.wikipedia.org/wiki/Ordinary_least_squares#Simple_linear_regression_model
  - https://devarea.com/linear-regression-with-numpy/


Aliases: LINEARREG, LinearReg, linreg

Inputs: close

Outputs: linreg

Params:
  - period (default: 14)

TA-LIB (with compatibility flag "_talib=True"):

`pminus1` is there for compatibility with the broken ta-lib behavior

If active, "p1" will be p - 1 and calculations will diverge by having
"0" as the 1st item of "x" ([0, period] instead of [1, period + 1])

The 1st behavior is used by ta-lib for `linearreg`,
`linearreg_intercept` and `tsf`.

The 2nd behavior is used by ta-lib for `linearreg_slope` and
`linearreg_angle`.

Intercept can be calculated as follows b = (Sum(y) - m * Sum(x)) / n.

In the default `ta-lib` behavior (and in the compatible one with this
method) this equation isn't true due to the
different period ranges used for the calculations.

linearreg_angle

Linear Regression of the values of an asset (y-axis) along the "x" (period
window, x-axix) using the least squares method to find the best fit.

Formula:
  - y = b + m * x

**This indicator returns: "m" or (slope)** (expressed in degrees)

See:
  - https://en.wikipedia.org/wiki/Ordinary_least_squares#Simple_linear_regression_model
  - https://devarea.com/linear-regression-with-numpy/


Aliases: LINEARREG_ANGLE, LinearReg_Angle, linreg_angle

Inputs: close

Outputs: slope

Params:
  - period (default: 14)

linearreg_intercept

Linear Regression of the values of an asset (y-axis) along the "x" (period
window, x-axix) using the least squares method to find the best fit.

Formula:
  - y = b + m * x

**This indicator returns: "b" or (intercept)**

See:
  - https://en.wikipedia.org/wiki/Ordinary_least_squares#Simple_linear_regression_model
  - https://devarea.com/linear-regression-with-numpy/


Aliases: LINEARREG_INTERCEPT, LinearReg_Intercept, linreg_intercept

Inputs: close

Outputs: intercept

Params:
  - period (default: 14)

TA-LIB (with compatibility flag "_talib=True"):

`pminus1` is there for compatibility with the broken ta-lib behavior

If active, "p1" will be p - 1 and calculations will diverge by having
"0" as the 1st item of "x" ([0, period] instead of [1, period + 1])

The 1st behavior is used by ta-lib for `linearreg`,
`linearreg_intercept` and `tsf`.

The 2nd behavior is used by ta-lib for `linearreg_slope` and
`linearreg_angle`.

Intercept can be calculated as follows b = (Sum(y) - m * Sum(x)) / n.

In the default `ta-lib` behavior (and in the compatible one with this
method) this equation isn't true due to the
different period ranges used for the calculations.

linearreg_slope

Linear Regression of the values of an asset (y-axis) along the "x" (period
window, x-axix) using the least squares method to find the best fit.

Formula:
  - y = b + m * x

**This indicator returns: "m" or (slope)**

See:
  - https://en.wikipedia.org/wiki/Ordinary_least_squares#Simple_linear_regression_model
  - https://devarea.com/linear-regression-with-numpy/


Aliases: LINEARREG_SLOPE, LinearReg_Slope, linreg_slope

Inputs: close

Outputs: slope

Params:
  - period (default: 14)

mad

Calculates the Mean Absolute Deviation ('mad') of the input over a given
period
See:
  - https://en.wikipedia.org/wiki/Average_absolute_deviation


Aliases: MAD, meandev, MeanDev, MeanDeviation, MeanAbsDeviation

Inputs: close

Outputs: meandev

Params:
  - period (default: 20)
    Period to consider
  - _ma (default: sma)
    Moving Average to use

stddev

Calculates the standard deviation of the passed data for a given period,
considering the data to be the entire population

See:
  - http://en.wikipedia.org/wiki/Standard_deviation


Aliases: StdDev, STDDEV, StandardDeviation, stddev_p, STDDEV_P

Inputs: close

Outputs: std

Params:
  - period (default: 20)
    Period to consider
  - ddof (default: 0)
    Degree of Freedom: 0 = population, > 0 sample

TA-LIB (with compatibility flag "_talib=True"):

Change period to 5

stddev_s

Calculates the standard deviation of the passed data for a given period,
considering the data to be a sample

See:
  - http://en.wikipedia.org/wiki/Standard_deviation


Aliases: stddev_sample, STDDEV_S, StandardDeviationSample

Inputs: close

Outputs: std

Params:
  - period (default: 20)
  - ddof (default: 1)
    Degree of Freedom: 0 = population, > 0 sample

TA-LIB (with compatibility flag "_talib=True"):

Change period to 5

tsf

Linear Regression of the values of an asset (y-axis) along the "x" (period
window, x-axix) using the least squares method to find the best fit.

Formula:
  - y = b + m * x

**This indicator returns: "b + m * x" (using x = period)**

See:
  - https://en.wikipedia.org/wiki/Ordinary_least_squares#Simple_linear_regression_model
  - https://devarea.com/linear-regression-with-numpy/


Aliases: TSF, TimeSeriesForecast

Inputs: close

Outputs: tsf

Params:
  - period (default: 14)

TA-LIB (with compatibility flag "_talib=True"):

`pminus1` is there for compatibility with the broken ta-lib behavior

If active, "p1" will be p - 1 and calculations will diverge by having
"0" as the 1st item of "x" ([0, period] instead of [1, period + 1])

The 1st behavior is used by ta-lib for `linearreg`,
`linearreg_intercept` and `tsf`.

The 2nd behavior is used by ta-lib for `linearreg_slope` and
`linearreg_angle`.

Intercept can be calculated as follows b = (Sum(y) - m * Sum(x)) / n.

In the default `ta-lib` behavior (and in the compatible one with this
method) this equation isn't true due to the
different period ranges used for the calculations.

var

Variance is the expectation of the squared deviation of a random variable
from its mean

See:
  - https://en.wikipedia.org/wiki/Variance


Aliases: VAR, Var

Inputs: close

Outputs: var

Params:
  - period (default: 5)
    Period to consider
  - ddof (default: 0)
    Degree of Freedom: 0 = population, > 0 sample

var_s

Variance is the expectation of the squared deviation of a random variable
from its mean

This version considers the population is a sample (ddof=1)

See:
  - https://en.wikipedia.org/wiki/Variance


Aliases: varsample, VARS, VarSample

Inputs: close

Outputs: var

Params:
  - period (default: 5)
  - ddof (default: 1)
    Degree of Freedom: 0 = population, > 0 sample

Math Transform

acos

Calculates the `arccos` function of the input, i.e.: the inverse
trigonometric function of `cos`

Formula:
  - acos = arccos(data)

See also:
  - https://en.wikipedia.org/wiki/Inverse_trigonometric_functions


Aliases: ACOS, arccos, arccosine

Inputs: close

Outputs: acos

Params:
  - degrees (default: False)

asin

Calculates the `arcsin` function of the input, i.e.: the inverse
trigonometric function of `sin`

Formula:
  - asin = arcsin(data)

See also:
  - https://en.wikipedia.org/wiki/Inverse_trigonometric_functions


Aliases: ASIN, arcsin, arcsine

Inputs: close

Outputs: asin

Params:
  - degrees (default: False)

atan

Calculates the `arctan` function of the input, i.e.: the inverse
trigonometric function of `tan`

Formula:
  - atan = arctan(data)

See also:
  - https://en.wikipedia.org/wiki/Inverse_trigonometric_functions


Aliases: ATAN, arctan, arctangent

Inputs: close

Outputs: atan

Params:
  - degrees (default: False)

ceil

Calculates the `ceil` function which maps the input to the least integer
greater than or equal to the input

Formula:
  - ceil = ceil(data)

See also:
  - https://en.wikipedia.org/wiki/Floor_and_ceiling_functions


Aliases: CEIL

Inputs: close

Outputs: ceil

cos

Calculates the `cosine` function of the input

Formula:
  - cos = cosine(data)

See also:
  - https://en.wikipedia.org/wiki/Trigonometric_functions


Aliases: COS, cosine

Inputs: close

Outputs: cos

Params:
  - degrees (default: False)

cosh

Calculates the `secant` function of the input (1/cosine)

Formula:
  - cosh = secant(data)

See also:
  - https://en.wikipedia.org/wiki/Trigonometric_functions


Aliases: COSH, secant

Inputs: close

Outputs: cosh

Params:
  - degrees (default: False)

exp

Calculates the natural logarithm of the input, i.e.: the logarithm with
base `e`

Formula:
  - exp = exp(data)

See also:
  - https://en.wikipedia.org/wiki/Exponential_function


Aliases: EXP

Inputs: close

Outputs: exp

floor

Calculates the `floor` function which maps the input to the greatest
integer least than or equal to the input

Formula:
  - floor = floor(data)

See also:
  - https://en.wikipedia.org/wiki/Floor_and_ceiling_functions


Aliases: FLOOR

Inputs: close

Outputs: floor

ln

Calculates the natural logarithm of the input, i.e.: the logarithm with
base `e`

Formula:
  - ln = ln(data)

See also:
  - https://en.wikipedia.org/wiki/Natural_logarithm


Aliases: LN, log, LOG

Inputs: close

Outputs: ln

log10

Calculates the common logarithm, i.e.: the logarithm with base 10, of the
input

Formula:
  - log10 = log10(data)

See also:
  - https://en.wikipedia.org/wiki/Common_logarithm


Aliases: LOG10

Inputs: close

Outputs: log10

sin

Calculates the `sine` function of the input

Formula:
  - sin = sine(data)

See also:
  - https://en.wikipedia.org/wiki/Trigonometric_functions


Aliases: SIN, sine

Inputs: close

Outputs: sin

Params:
  - degrees (default: False)

sinh

Calculates the `cosecant` function of the input (1/sine)

Formula:
  - sinh = cosecant(data)

See also:
  - https://en.wikipedia.org/wiki/Trigonometric_functions


Aliases: SINH, cosecant

Inputs: close

Outputs: sinh

Params:
  - degrees (default: False)

sqrt

Calculates the square root of the input

Formula:
  - sqrt = sqrt(data)

See also:
  - https://en.wikipedia.org/wiki/Square_root


Aliases: SQRT

Inputs: close

Outputs: sqrt

tan

Calculates the `tangent` function of the input

Formula:
  - tan = tangent(data)

See also:
  - https://en.wikipedia.org/wiki/Trigonometric_functions


Aliases: TAN, tangent

Inputs: close

Outputs: tan

Params:
  - degrees (default: False)

tanh

Calculates the `cotangent` function of the input (1/tangent)

Formula:
  - tanh = cotangent(data)

See also:
  - https://en.wikipedia.org/wiki/Trigonometric_functions


Aliases: TANH, cotangent

Inputs: close

Outputs: tanh

Params:
  - degrees (default: False)

Math Operators

add

Calculates the summation of the two inputs

Formula:
  - add = data0 + data1


Aliases: ADD

Inputs: input1, input2

Outputs: add

div

Calculates the division of the two inputs

Formula:
  - div = data0 / data1


Aliases: DIV

Inputs: input1, input2

Outputs: div

max

Rolling maximum over `period` of the input

Formula:
  - max = max(data, period)


Aliases: highest, Highest, maxn, MaxN, MAX

Inputs: close

Outputs: max

Params:
  - period (default: 30)
    Period to consider

maxindex

Rolling index of the max value over a period

Formula:
  - maxindex = data.index(max(data, period))


Aliases: MAXINDEX

Inputs: close

Outputs: maxindex

Params:
  - period (default: 30)
    Period to consider
  - _absidx (default: False)
    Return maxindex over the entire period

TA-LIB (with compatibility flag "_talib=True"):

ta-lib returns 0 as index during the warm-up period and then returns the
absolute index over the entire series and not over the window period

min

Rolling minimum over `period` of the input

Formula:
  - min = min(data, period)


Aliases: lowest, Lowest, minn, MinN, MIN

Inputs: close

Outputs: min

Params:
  - period (default: 30)
    Period to consider

minindex

Rolling index of the max value over a period

Formula:
  - maxindex = data.index(max(data, period))


Aliases: MININDEX

Inputs: close

Outputs: minindex

Params:
  - period (default: 30)
    Period to consider
  - _absidx (default: False)
    Return maxindex over the entire period

TA-LIB (with compatibility flag "_talib=True"):

ta-lib returns 0 as index during the warm-up period and then returns the
absolute index over the entire series and not over the window period

minmax

Rolling the minimum and maximo over `period` of the input

Formula:
  - min = min(data, period)
  - min = max(data, period)


Aliases: MINMAX

Inputs: close

Outputs: min, max

Params:
  - period (default: 30)
    Period to consider

minmaxindex

Rolling index of the max value over a period

Formula:
  - maxindex = data.index(max(data, period))


Aliases: MINMAXINDEX

Inputs: close

Outputs: minindex, maxindex

Params:
  - period (default: 30)
    Period to consider
  - _absidx (default: False)
    Return maxindex over the entire period

TA-LIB (with compatibility flag "_talib=True"):

ta-lib returns 0 as index during the warm-up period and then returns
the absolute index over the entire series and not over the window
period

mult

Calculates the multiplication of the two inputs

Formula:
  - mult = data0 * data1


Aliases: MULT

Inputs: input1, input2

Outputs: mult

sub

Calculates the subtraction of the two inputs

Formula:
  - sub = data0 - data1


Aliases: SUB

Inputs: input1, input2

Outputs: sub

sum

Rolling sum over `period` of the input

Formula:
  - sum = sum(data, period)


Aliases: sumn, Sum, SumN, SUM

Inputs: close

Outputs: sum

Params:
  - period (default: 30)
    Period to consider

Utils

crossdown

This indicator gives a signal if the 1st provided data crosses over the 2nd
indicator upwards

It does need to look into the current time index (0) and the previous time
index (-1) of both the 1st and 2nd data

Formula:
  - crossdown = data0(-1) > data1(-1) and data0 < data1


Aliases: CrossDown

Inputs: crosser, crossed

Outputs: crossdown

Params:
  - _strict (default: False)

crossover

This indicator gives a signal if the provided datas (2) cross up or down.

  - `1.0` if the 1st data crosses the 2nd data upwards
  - `-1.0` if the 1st data crosses the 2nd data downwards

It does need to look into the current time index (0) and the previous time
index (-1) of both the 1st and 2nd data

Formula:
  - crossup = data0(-1) < data1(-1) and data0 > data1
  - crossdown = data0(-1) > data1(-1) and data0 < data1
  - crossover = crossup - crossdown


Aliases: CrossOver

Inputs: crosser, crossed

Outputs: crossover

Params:
  - _strict (default: False)

crossup

This indicator gives a signal if the 1st provided data crosses over the 2nd
indicator upwards

It does need to look into the current time index (0) and the previous time
index (-1) of both the 1st and 2nd data

Formula:
  - crossup = data0(-1) < data1(-1) and data0 > data1


Aliases: CrossUp

Inputs: crosser, crossed

Outputs: crossup

Params:
  - _strict (default: False)

Pattern Recognition