This repository contains a Python script to plot candlestick charts and identify key support and resistance levels using the Nifty 50 index data.
Technical analysis often involves identifying support and resistance levels to understand market trends. This project automates this process by:
- Loading Nifty 50 index data for a specified time range.
- Plotting candlestick charts using the
mplfinancelibrary. - Identifying support and resistance levels with the help of the
argrelextremafunction fromscipy. - Overlaying the levels on the candlestick chart for visualization.
- Dynamic Support and Resistance Levels: Adjust the sensitivity using the
orderparameter. - Custom Chart Styling: Utilize custom themes for professional-looking charts.
- Visualization with Volume: Charts include volume bars for deeper market insights.
Ensure you have the following Python packages installed:
pandasmplfinancematplotlibscipynumpy
Install the required packages using pip:
pip install pandas mplfinance matplotlib scipy numpyThe input data should be in CSV format with the following columns:
| Date | Open | High | Low | Close | Shares Traded | Turnover (₹ Cr) |
|---|---|---|---|---|---|---|
| 08-JAN-2024 | 21747.6 | 21763.95 | 21492.9 | 21513 | 231452935 | 21140.94 |
| 09-JAN-2024 | 21653.6 | 21724.45 | 21517.85 | 21544.85 | 228568589 | 24055.74 |
Rename the column Shares Traded to Volume during preprocessing.
- Clone this repository:
git clone https://github.com/asircar/candlestick-support-resistance.git- Navigate to the repository:
cd candlestick-support-resistance-
Replace
NIFTY 50-06-01-2024-to-06-01-2025.csvwith your own dataset in the same format. -
Run the script:
python script.pyThe script generates a candlestick chart with:
- Red dashed lines for resistance levels.
- Green dashed lines for support levels.
- Volume bars for additional context.
This code is provided as-is, with no warranties or guarantees. It is free for anyone to view, use, or modify for their own purposes. Credit is appreciated but not required.
- Data Source: NSE India Historical Index Data
- Development Tools: This project was developed using GitHub Copilot and ChatGPT.
Contributions, issues, and feature requests are welcome! Feel free to fork the repository and submit pull requests.
Feel free to reach out with questions or suggestions. Happy coding!
