Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Range exception index -1 in indicator method unroll_signal_list #74

Open
fredblockchain opened this issue Jan 25, 2023 · 0 comments
Open

Comments

@fredblockchain
Copy link

Describe the bug
Hi Kieran,
First of all, thanks for the work you've done, I'm currently trying to learn from your indicators,I liked the idea you implemented for swing detection, that's when I found this issue.
It looks a bit too obvious to me, it kind of looks like it would always fail, so maybe I'm doing something wrong.

I detected that the determination of the range for the following FOR loop is starting with 0 and the "signal[i-1]" part is not working because of a negative index during the first iteration:

for i in range(len(signals)):
if signals[i] != signals[i - 1]:
unrolled_signals[i] = signals[i]

Same exception if I try to run it on an indicator (rsi)

To Reproduce

  • I'm testing the indicator class out of Autotrader (in freqtrade).
  • I'm testing on a dataframe with 450 values (plenty of swings).
  • I'm first calling find_swings on price data ( I have to rename each series because first letter in lower case in freqtrade and your class requires Uppercase). This call returns coherent results, no NA values or anything strange
  • Than I call classify_swings, that's when the exception is generated,

Expected behavior
The following modification makes it work, making it start from 1.
for i in range(1, len(signals)):
Results look good

Version of AutoTrader being used
the last one, from this commit

If you need anything, just le me know
Cheers
Fred

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant