TradingPatternScanner icon indicating copy to clipboard operation
TradingPatternScanner copied to clipboard

Executing detect_wedge() fails

Open alatif-alatif opened this issue 2 years ago • 0 comments

Hi,

thanks a lot for setting up, sharing and maintaining this project. You are doing a very good job!

I have a small question:

I executed detect_wedge(df, window=3): from TradingPatternScanner/tradingpatterns/tradingpatterns.py.

Unfortunately, I get an error:

File ".../lib/python3.10/site-packages/pandas/core/indexes/range.py", line 416, in get_loc
raise KeyError(key) from err
KeyError: -1

This error comes up at this line:

df['trend_high'] = df['High'].rolling(window=roll_window).apply(lambda x: 1 if (x[-1] - x[0]) > 0 else -1 if (x[-1] - x[0]) < 0 else 0)

Am I doing something wrong? Respectively: what do I have to do to get beyond this point?

used versions:

pandas: 2.1.0
python: 3.10.12

Thanks in advance.

alatif-alatif avatar Sep 08 '23 19:09 alatif-alatif