python-tradingview-ta icon indicating copy to clipboard operation
python-tradingview-ta copied to clipboard

list index out of range

Open Magiccode2022 opened this issue 3 years ago • 6 comments

My trader program is in such a way that I have to test on several currencies at the same time, but when I query the indicator through the TradingView library, I encounter the following error. Is there a way to fix it?

File "/usr/local/lib/python3.9/site-packages/tradingview_ta/main.py", line 316, in get_indicators indicators_val[indicators[x]] = result[0]["d"][x] IndexError: list index out of range

Magiccode2022 avatar Sep 17 '22 11:09 Magiccode2022

HI I wish to contribute to the same. Could you help me with the inputs to be provided so can I can test and solve the issue.

kshitiz305 avatar Sep 20 '22 12:09 kshitiz305

Hi Very thanks ........................... def check(market): handler = TA_Handler( screener="crypto", interval= Interval.INTERVAL_5_MINUTES, symbol=market, exchange="COINEX", ) handler.add_indicators([ "Candle.Engulfing.Bearish[1]", "Candle.Engulfing.Bullish[1]", ]) analysis = handler.get_analysis() pattern_count = 0 for key, value in analysis.indicators.items(): if "Candle" in key: if value == 1: a=key pattern_count += 1 if pattern_count == 0: return "no candle","normal" ....................................... I run it once through my own program and there is no problem, but twice for two currencies the error I mentioned occurs

Magiccode2022 avatar Sep 20 '22 12:09 Magiccode2022

I have tried to run this function provided in the test.py , but it asks me for the market argument when being called. what is the value of market, when you mention twice for two currency what input changes ,

kshitiz305 avatar Sep 20 '22 13:09 kshitiz305

Market=BTCUSDT RUN THIS FUNCTUON FROM WEB FORM Only change market Example : ETHUSDT

Magiccode2022 avatar Sep 20 '22 13:09 Magiccode2022

image Sorry to disturb you this being my initial issue with the project it is still seems unclear to me. What values are giving you an error.

kshitiz305 avatar Sep 20 '22 17:09 kshitiz305

I have tried this function it seems fine for me image

kshitiz305 avatar Sep 20 '22 17:09 kshitiz305