Install PatternPy
mainTo install PatternPy, clone the repository and place it in your working directory. You can then import it into your Python projects like any other local package.
git clone https://github.com/keithorange/PatternPyrepository·main·Indexed 19 days ago
https://github.com/keithorange/patternpyA high-performance Python package for automated trading pattern recognition in financial markets. Leveraging Pandas and Numpy, it identifies patterns such as head and shoulders, triangles, and wedges from OHLCV data.
To install PatternPy, clone the repository and place it in your working directory. You can then import it into your Python projects like any other local package.
git clone https://github.com/keithorange/PatternPyYou can use the head_and_shoulders function from patternpy.tradingpatterns to scan a Pandas DataFrame containing OHLCV (Open, High, Low, Close, Volume) data.
When applied, the function adds a new column named head_shoulder_pattern to your DataFrame. This column contains one of the following values:
NaN: No pattern detected.'Head and Shoulder': A standard head and shoulders pattern was identified.'Inverse Head and Shoulder': An inverse head and shoulders pattern was identified.from patternpy.tradingpatterns import head_and_shoulders
import pandas as pd
# Have price data (OCHLV dataframe)
df = pd.DataFrame(stock_data)
# Apply pattern indicator screener
df = head_and_shoulders(df)
# New column `head_shoulder_pattern` is created with entries containing either: NaN, 'Head and Shoulder' or 'Inverse Head and Shoulder'
print(df)