Skip to content

supertrend exception #2

Open
Open
@Sinansi

Description

Python version 3.9

get_supertrend(high, low, close, lookback=10, multiplier=3)
Traceback (most recent call last):
File "C:\Users\Sinan\miniconda3\envs\TradingView\lib\site-packages\pandas\core\indexes\base.py", line 3790, in get_loc
return self._engine.get_loc(casted_key)
File "index.pyx", line 152, in pandas._libs.index.IndexEngine.get_loc
File "index.pyx", line 181, in pandas._libs.index.IndexEngine.get_loc
File "pandas_libs\hashtable_class_helper.pxi", line 2606, in pandas._libs.hashtable.Int64HashTable.get_item
File "pandas_libs\hashtable_class_helper.pxi", line 2630, in pandas._libs.hashtable.Int64HashTable.get_item
KeyError: 5491
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2023.2\plugins\python\helpers\pydev\pydevconsole.py", line 364, in runcode
coro = func()
File "", line 1, in
File "C:\Galaxy\Project\TradingView\supertrend.py", line 30, in get_supertrend
if (upper_band[i] < final_bands.iloc[i - 1, 0]) | (close[i - 1] > final_bands.iloc[i - 1, 0]):
File "C:\Users\Sinan\miniconda3\envs\TradingView\lib\site-packages\pandas\core\series.py", line 1040, in getitem
return self._get_value(key)
File "C:\Users\Sinan\miniconda3\envs\TradingView\lib\site-packages\pandas\core\series.py", line 1156, in _get_value
loc = self.index.get_loc(label)
File "C:\Users\Sinan\miniconda3\envs\TradingView\lib\site-packages\pandas\core\indexes\base.py", line 3797, in get_loc
raise KeyError(key) from err
KeyError: 5491

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions