hilo#
API documentation for pandas_ta.overlap.hilo Python function.
- hilo(high, low, close, high_length=None, low_length=None, mamode=None, offset=None, **kwargs)[source]#
Gann HiLo Activator(HiLo)
The Gann High Low Activator Indicator was created by Robert Krausz in a 1998 issue of Stocks & Commodities Magazine. It is a moving average based trend indicator consisting of two different simple moving averages.
The indicator tracks both curves (of the highs and the lows). The close of the bar defines which of the two gets plotted.
Increasing high_length and decreasing low_length better for short trades, vice versa for long positions.
- Sources:
https://www.sierrachart.com/index.php?page=doc/StudiesReference.php&ID=447&Name=Gann_HiLo_Activator https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/simple-moving-average-sma/ https://www.tradingview.com/script/XNQSLIYb-Gann-High-Low/
- Calculation:
- Default Inputs:
high_length=13, low_length=21, mamode=”sma”
EMA = Exponential Moving Average HMA = Hull Moving Average SMA = Simple Moving Average # Default
- if “ema”:
high_ma = EMA(high, high_length) low_ma = EMA(low, low_length)
- elif “hma”:
high_ma = HMA(high, high_length) low_ma = HMA(low, low_length)
- else: # “sma”
high_ma = SMA(high, high_length) low_ma = SMA(low, low_length)
# Similar to Supertrend MA selection hilo = Series(npNaN, index=close.index) for i in range(1, m):
- if close.iloc[i] > high_ma.iloc[i - 1]:
hilo.iloc[i] = low_ma.iloc[i]
- elif close.iloc[i] < low_ma.iloc[i - 1]:
hilo.iloc[i] = high_ma.iloc[i]
- else:
hilo.iloc[i] = hilo.iloc[i - 1]
- Args:
high (pd.Series): Series of ‘high’s low (pd.Series): Series of ‘low’s close (pd.Series): Series of ‘close’s high_length (int): It’s period. Default: 13 low_length (int): It’s period. Default: 21 mamode (str): See
`help(ta.ma)`
. Default: ‘sma’ offset (int): How many periods to offset the result. Default: 0- Kwargs:
adjust (bool): Default: True presma (bool, optional): If True, uses SMA for initial value. fillna (value, optional): pd.DataFrame.fillna(value) fill_method (value, optional): Type of fill method
- Returns:
pd.DataFrame: HILO (line), HILOl (long), HILOs (short) columns.