AutoTrader icon indicating copy to clipboard operation
AutoTrader copied to clipboard

Range exception index -1 in indicator method unroll_signal_list

Open fredblockchain opened this issue 2 years ago • 0 comments

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

fredblockchain avatar Jan 25 '23 11:01 fredblockchain