An automated Python-based stock screener that filters the Nifty 500 universe for high-probability, institutional-grade breakout setups and delivers real-time alerts directly to a Telegram group.
This script is designed to run automatically at market close. It downloads 2 years of historical daily OHLCV data for 467 tradable NSE equities via Yahoo Finance (yfinance). It then pushes every stock through a strict 6-Gate Technical Filter based on Trend, Volatility Contraction (VCP), and Relative Strength.
Stocks that survive all 6 gates are formatted into a clean report and fired off to a designated Telegram chat via a custom bot.
- Stateless Execution: Pulls fresh data on every run to prevent corrupted local cache issues.
- Vectorized Math: Uses
pandasandpandas-tato calculate technical indicators for 467 stocks in seconds. - Anti-Bot Proxy Avoidance: Designed to run locally (avoiding cloud firewall IP bans from Yahoo Finance).
- Automated Delivery: Integrates directly with the Telegram Bot API for instant push notifications.
For a stock to trigger an alert, it must pass all six of these conditions simultaneously on the daily timeframe:
- The Macro Trend: Current Close > 200 SMA AND 50 SMA > 200 SMA. (Ensures we only buy in confirmed macro uptrends).
- Volatility Contraction (VCP): Yesterday's 10-day ATR < Yesterday's 50-day ATR. (Ensures the stock was tightly coiled and building energy before today's move).
- Relative Strength: 50-day return > Nifty 50 benchmark (
^NSEI) 50-day return. (Filters out market laggards). - Institutional Volume: Today's Volume > 1.8x the 20-day Average Volume. (Proves heavy institutional money is driving the move).
- The Breakout: Today's Close > Highest High of the last 50 trading sessions. (The actual trigger clearing medium-term resistance).
- Anti-Chase Buffer: Today's Close is <= 8% above the 50-day resistance line. (Prevents buying into overextended, runaway gaps).
- Python 3.9+ installed on your machine.
- A Telegram Bot Token (Create one via @BotFather on Telegram).
- A Telegram Chat ID (The ID of the group or user receiving the alerts).
git clone [https://github.com/YourUsername/Stock-Screener.git](https://github.com/YourUsername/Stock-Screener.git)
cd Stock-Screener