uo#

uo(high, low, close, fast=None, medium=None, slow=None, fast_w=None, medium_w=None, slow_w=None, talib=None, drift=None, offset=None, **kwargs)[source]#

Ultimate Oscillator (UO)

The Ultimate Oscillator is a momentum indicator over three different periods. It attempts to correct false divergence trading signals.

Sources:

https://www.tradingview.com/wiki/Ultimate_Oscillator_(UO)

Calculation:
Default Inputs:

fast=7, medium=14, slow=28, fast_w=4.0, medium_w=2.0, slow_w=1.0, drift=1

min_low_or_pc = close.shift(drift).combine(low, min) max_high_or_pc = close.shift(drift).combine(high, max)

bp = buying pressure = close - min_low_or_pc tr = true range = max_high_or_pc - min_low_or_pc

fast_avg = SUM(bp, fast) / SUM(tr, fast) medium_avg = SUM(bp, medium) / SUM(tr, medium) slow_avg = SUM(bp, slow) / SUM(tr, slow)

total_weight = fast_w + medium_w + slow_w weights = (fast_w * fast_avg) + (medium_w * medium_avg) + (slow_w * slow_avg) UO = 100 * weights / total_weight

Args:

high (pd.Series): Series of ‘high’s low (pd.Series): Series of ‘low’s close (pd.Series): Series of ‘close’s fast (int): The Fast %K period. Default: 7 medium (int): The Slow %K period. Default: 14 slow (int): The Slow %D period. Default: 28 fast_w (float): The Fast %K period. Default: 4.0 medium_w (float): The Slow %K period. Default: 2.0 slow_w (float): The Slow %D period. Default: 1.0 talib (bool): If TA Lib is installed and talib is True, Returns the TA Lib

version. Default: True

drift (int): The difference period. Default: 1 offset (int): How many periods to offset the result. Default: 0

Kwargs:

fillna (value, optional): pd.DataFrame.fillna(value) fill_method (value, optional): Type of fill method

Returns:

pd.Series: New feature generated.