[Python] Quantifying Mark Minervini's VCP Strategy: Automating US Stock Scanning to AI Diagnosis
Last updated: February 15, 2026
Posted: February 15, 2026
Introduction
In US stock investing, Mark Minervini's advocated VCP (Volatility Contraction Pattern) and RS (Relative Strength) — measuring relative strength against the overall market — are extremely powerful techniques.
However, it is physically impossible for individual investors to visually scan hundreds or thousands of stocks every day to find those that "perfectly match the conditions right now." Moreover, humans are inevitably influenced by emotions, leading to delayed stop-losses or entries without solid reasoning.
To address this, I built "SENTINEL PRO", an integrated US stock scanner that combines technicals, fundamentals, and AI diagnosis — turning my own investment discipline into a system for efficiency and objectivity.
1. Deliverables
The developed code and demo site are publicly available here:
- GitHub: https://github.com/EMMA019/US-stocks
- Live Demo: https://us-stockssc.streamlit.app/
※ The demo site runs on Streamlit Cloud and uses yfinance for data retrieval.
2. System Design Philosophy
"SENTINEL PRO" is not just a simple screener — it automatically filters and evaluates stocks in the following three steps:
① Quantitative Technical Analysis (VCP Scoring)
I defined subjective "price contraction" as an objective 105-point score using a custom algorithm.
- Tightness (40pt): Compares high-low ranges over 20/30/40/60 days to detect volatility contraction.
- Volume (30pt): Checks if recent volume has dried up relative to historical averages.
- MA Alignment (30pt): Confirms perfect order in 50/150/200-day moving averages (rising trend).
- Pivot Bonus (5pt): Measures proximity to recent high (pivot point).
② Mathematical Position Sizing
To strictly manage risk, position size is calculated backward from allowable loss per trade (e.g., 1.5% of total capital), adjusted for volatility.
Shares = min( (Total Capital × Account Risk %) / (Entry - Stop) , (Total Capital × 0.4) / Entry )
③ AI Qualitative Diagnosis
For stocks filtered by quantitative scan, the latest news and insider activity are fed into DeepSeek (AI) via API. This generates a final report considering risks and catalysts invisible in pure technicals.
3. Tech Stack and Automation
- Language: Python 3.11
- Libraries: yfinance (data fetch), pandas (analysis), streamlit (UI), plotly (visualization)
- Infrastructure: GitHub Actions (daily auto-run), Streamlit Cloud
- Notification: LINE Notify API
GitHub Actions automatically scans after US market close, saves results as JSON, and sends LINE notifications with details for any "ACTION" (immediate consideration) stocks that match criteria.
4. Real Trade Example: Corning (GLW)
Here’s an actual example of how the system performed in February 2026.
Corning (GLW), a major optical fiber company, saw a sharp RS surge due to a massive contract news with Meta. The system detected a temporary tight contraction (VCP) and triggered a signal.
| Item | Content |
|---|---|
| Ticker | Corning (GLW) |
| Entry Price | $116.00 (filled on 2/7) |
| Exit Price | $130.30 (filled on 2/11) |
| Return | +12.3% |
| Holding Period | 4 trading days |
Insight
The system captured the tight flag formation after the surge. Additionally, the insider monitoring engine detected high-level selling near highs, allowing mechanical profit-taking at the target R-multiple without chasing further.
5. Summary
"SENTINEL PRO" aims to eliminate "indecision" from investing through engineering.
There is no holy grail in investing, but systematically finding high-expectancy patterns and taking mathematically correct risks is an effective way to improve long-term survival probability.
The source code is open on GitHub. Feel free to fork it and customize with your own strategies.
GitHub: https://github.com/EMMA019/US-stocks
Disclaimer:
This article and tool are for educational and research purposes only and do not constitute investment advice or recommendations to buy/sell any specific securities. All investment decisions are your own responsibility.
Top comments (0)