TradingPatternScanner
TradingPatternScanner copied to clipboard
Executing detect_wedge() fails
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.