GAP Pattern Detection in Candlestick Charts, Run Inference 🚀
Automating the detection of GAP UP and GAP DOWN patterns in candlestick charts using YOLO object detection.
- Project Overview
- Key Concepts
- Project Details
- Getting Started
- Try It Online
- Dataset
- Technologies Involved
- Successor Note
- Contributing
- License
- Acknowledgments
This project focuses on detecting GAP UP and GAP DOWN patterns in candlestick charts, which are widely used in technical analysis for stock market trading. Using a YOLOv11l (You Only Look Once) object detection model, the project identifies these patterns in candlestick chart images. The model is trained on a custom dataset and can be used to analyze charts for potential market movements.
It is designed to help traders and analysts quickly identify GAP patterns, saving time and improving accuracy in technical analysis. It includes a Gradio-based web interface for easy interaction and real-time detection.
Candlestick charts are a type of financial chart used to represent the price movement of an asset (e.g., stocks, cryptocurrencies) over time. Each "candlestick" consists of:
- Body: Represents the opening and closing prices.
- Wicks (or Shadows): Represent the highest and lowest prices during the time period.
Candlestick charts are widely used in technical analysis to identify trends, reversals, and patterns.
- GAP UP: Occurs when the lowest price of the current candlestick is higher than the highest price of the previous candlestick. This indicates a strong upward momentum and is often considered a bullish signal.
- GAP DOWN: Occurs when the highest price of the current candlestick is lower than the lowest price of the previous candlestick. This indicates a strong downward momentum and is often considered a bearish signal.
These patterns are significant because they can signal potential breakouts or reversals in the market.
- Input: The user uploads an image of a candlestick chart or interacts with the Gradio interface.
- Detection: The YOLOv11l model processes the image to detect GAP UP and GAP DOWN patterns.
- Output: An annotated image with detected patterns highlighted, along with counts of GAP UP and GAP DOWN patterns.
The YOLO model is trained to detect two classes:
- Class 0: GAP DOWN
- Class 1: GAP UP
- The model is trained on a custom dataset of annotated candlestick charts.
- The dataset includes images with labeled GAP UP and GAP DOWN patterns.
- The model is saved as
best.pt
and loaded for inference.
To run this project locally, you need:
- Python 3.8 or higher
- Pip (Python package manager)
- A GPU (recommended for faster inference)
- Clone the repository:
git clone https://github.com/your-username/gap-pattern-detection.git cd gap-pattern-detection
- Install the required dependencies:
pip install -r requirements.txt
- Download the trained model weights (
best.pt
) from the Roboflow dataset page and place it in themodels
directory. - Run the Gradio interface:
python app.py
- The output will be saved as output_image.jpg in the results directory.
You can try the project without installing anything locally by using the Hugging Face Spaces deployment: 👉 GAP Pattern Detection on Hugging Face
The dataset used for training the model is publicly available on Roboflow. You can access it here: 🔗 Roboflow Dataset: GAP Pattern Detection
The dataset includes:
- Annotated images of candlestick charts.
- Labels for GAP UP and GAP DOWN patterns.
- YOLOv11l: For object detection.
- Gradio: For creating a user-friendly web interface.
- OpenCV (cv2): For image processing and annotation.
- Roboflow: For dataset management and annotation.
We’re excited to announce that Version 2 of this project is currently in development! While we can’t reveal all the details just yet, here’s a sneak peek at what’s coming:
- Real-Time Market Insights: Version 2 will take GAP pattern detection to the next level by integrating live market data. Imagine detecting GAP patterns as they form, in real-time!
- Enhanced User Experience: A more dynamic and interactive interface that adapts to real-time changes in the market.
- Advanced Analytics: New features to help you gain deeper insights into market trends and patterns.
Stay tuned for updates as we work on bringing these exciting new features to life. The future of GAP pattern detection is just around the corner!
We welcome contributions to improve the model, dataset, or interface. Here’s how you can contribute:
-
Fork the repository and clone it:
git clone https://github.com/your-username/gap-pattern-detection.git```
-
Create a new branch for your feature or bugfix:
git checkout -b feature/your-feature-name```
-
Make your changes and commit them:
git commit -m "Add your message here"```
-
Push your changes to your fork:
git push origin feature/your-feature-name```
-
Open a Pull Request on the main repository.
For more information, head to CONTRIBUTING file
If you’re labeling new data for the dataset, follow these guidelines:
- Use a labeling tool like LabelImg or CVAT.
- For each GAP UP or GAP DOWN pattern:
- Draw a bounding box around the two candlesticks involved in the pattern.
- Assign the correct class label (0 for GAP DOWN, 1 for GAP UP).
- Ensure the bounding boxes are tight and accurate.
This project is licensed under the MIT License. See the LICENSE file for details.
- Roboflow for providing the dataset and annotation tools.
- Ultralytics for the YOLO object detection framework.
- Gradio for the web interface framework.
- HF Spaces for the deployment platform.
- GitHub: Cipher-unhsiV
- Email: [email protected]
- LinkedIn: Vishnuvasan T S
Happy Trading and Coding! 🚀