pandas-ta
pandas-ta copied to clipboard
HiLo is not working perfectly, same numbers printing many time.
Which version are you running? The lastest version is on Github. Pip is for major releases.
import pandas_ta as ta
print(ta.version)
Do you have TA Lib also installed in your environment?
$ pip list
Did you upgrade? Did the upgrade resolve the issue?
$ pip install -U git+https://github.com/twopirllc/pandas-ta
Describe the bug A clear and concise description of what the bug is.
To Reproduce Provide sample code.
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
Thanks for using Pandas TA!
Hello @whatismyname21,
I can not help you as you have not completed the above form nor have you provided enough evidence (context, data, reproducible code, screenshots) to convince us that this is anything but a baseless claim.
Clearly not a lot of the same number printing many times:

Kind Regards, KJ
Hi Kevin
I have used below code
HILO = ta.hilo(df["High"],df["Low"],df["Close"], high_length=2, low_length=4)
Price is moving but i am getting same result many time. Please find attached screenshot.
Thanks Aj
@whatismyname21,
Again:
- What version of Pandas TA are you using?
- What ticker and timeframe are you using?
- Do you have csv of the offending ohlcv data so I can see what the problem is?
- Do you have screenshots?
Thanks for providing the indicator and parameters that are not working.
KJ
Hi Kevin
Please answer in line...
- What version of Pandas TA are you using? -- 1.3.4
- What ticker and timeframe are you using? - 5mins or 1day
- Do you have csv of the offending ohlcv data so I can see what the problem is? - Getting data from yahoo
- Do you have screenshots? - Please find attachment...
@whatismyname21
Thanks, we are getting there... What ticker/symbol?
There is no such Pandas TA version: 1.3.4
import pandas_ta as ta
print(ta.version)
Sorry to bug you, but my main strategy is on Gann HiLo
Version - 0.3.14b0
Ticker name - AAPL
Today's data

@whatismyname21
Your small ma lengths can cause the conditional logic to repeat values until the close price either exceeds the previous high/low sma values.
You should add the sma's and compare for yourself that the logic is working as implemented.
df = # your ohlcv data
df.ta.sma(2, append=True)
df.ta.sma(4, append=True)
df.ta.hilo(high_length=2, low_length=4, append=True)
print(df)
HILO core logic:
def hilo(high, low, close, high_length=None, low_length=None, mamode=None, offset=None, **kwargs):
"""Indicator: Gann HiLo (HiLo)"""
# Validate Arguments
# ...
high_ma = ma(mamode, high, length=high_length)
low_ma = ma(mamode, low, length=low_length)
for i in range(1, m):
if close.iloc[i] > high_ma.iloc[i - 1]:
hilo.iloc[i] = long.iloc[i] = low_ma.iloc[i]
elif close.iloc[i] < low_ma.iloc[i - 1]:
hilo.iloc[i] = short.iloc[i] = high_ma.iloc[i]
else:
hilo.iloc[i] = hilo.iloc[i - 1]
long.iloc[i] = short.iloc[i] = hilo.iloc[i - 1]
# ...
@whatismyname21,
Lately, I have been speeding up indicators on the development branch. When I get to this one, I'll double check it.