This repository houses a Python script for automated identification of support and resistance levels in historical stock price data. Leveraging k-means clustering and the elbow method, the script provides a comprehensive solution for traders and analysts to pinpoint key levels of price significance. The script further allows for the retrieval of stock data from Yahoo Finance, optimal clustering determination, and the creation of visually insightful OHLC (Open, High, Low, Close) charts with highlighted support and resistance lines.
- Download historical stock data using Yahoo Finance API.
- Find optimal clusters based on the elbow method.
- Identify support and resistance levels using k-means clustering and local extrema.
- Plot OHLC charts with highlighted support and resistance lines.
- Install pipenv:
pip install pipenv
. - Install the required libraries:
pipenv install
. - Run the
main.py
script with your preferred stock ticker symbol.
python main.py AAPL
python main.py AALI.JK