Skip to content

jerrylin-23/Alpha_Radar

Repository files navigation

Alpha Radar

Formerly ICT Buy the Dip Analyzer

A Python-based algorithmic trading tool that detects ICT (Inner Circle Trader) concepts to generate actionable trade plans. Alpha Radar identifies liquidity pools, imbalances, and market structure to find high-probability long entries, and serves them through a live web scanner.

Python Flask React TypeScript Vite Postgres License


πŸ“š ICT Concepts Explained

Understanding why this strategy works requires knowledge of how institutional traders and market makers operate.

πŸ”΄ Equal Highs/Lows (EQH/EQL) β€” Liquidity Magnets

What they are:
Equal Highs (EQH) and Equal Lows (EQL) are price levels where multiple swing points cluster at nearly the same price. These levels represent liquidity pools β€” concentrations of stop-loss orders.

Why they matter:

  • Retail traders place stops above EQH and below EQL β€” these are obvious "resistance" and "support" levels.
  • Market makers hunt these stops β€” large institutions need liquidity to fill massive orders. They push price into these zones to trigger stop-losses, absorbing retail orders as counterparty liquidity.
  • EQH acts as resistance... until it's raided β€” price often sweeps through EQH/EQL before reversing.

How this tool uses them:

  • Identifies EQL as potential entry zones (price will sweep below before reversal)
  • Places stop-loss slightly below EQL to avoid getting stopped out during liquidity grabs
  • Uses the liquidity sweep as confirmation of reversal

πŸ“Š Fair Value Gaps (FVGs) β€” Imbalances in Price

What they are:
A Fair Value Gap is a 3-candle pattern where the wicks of candle 1 and candle 3 don't overlap, leaving a "gap" in price. This gap represents an imbalance β€” price moved so aggressively that no trades occurred in that zone.

Why price reacts at FVGs:

  • Unfilled orders exist in the gap β€” institutions that missed entries will look to fill orders when price returns.
  • Price seeks efficiency β€” markets tend to fill imbalances before continuing the trend.
  • FVGs act as magnets β€” price is "drawn" back to these zones before making the next major move.

Bullish vs Bearish FVGs:

  • Bullish FVG: Gap created by an up-move β†’ expect price to retrace INTO the gap, find support, and continue higher.
  • Bearish FVG: Gap created by a down-move β†’ expect price to rally INTO the gap, find resistance, and continue lower.

How this tool uses them:

  • Identifies nearest bullish FVG below current price as entry zone
  • Combines FVG with EQL for confluence (strongest setups)
  • Uses FVG midpoint as a refined entry target

πŸ“ˆ Power of 3 (PO3) β€” Market Maker Algorithm

What it is:
The Power of 3 describes a recurring 3-phase market cycle that institutions use to accumulate positions:

  1. Accumulation β€” Smart money quietly builds positions. Price consolidates. This is often where EQL/EQH form.

  2. Manipulation β€” Price is pushed against the intended direction to:

    • Trigger stop-losses (liquidity grab)
    • Create FVGs (imbalances to return to)
    • Trap retail traders on the wrong side
  3. Distribution β€” Price explodes in the real direction as institutions distribute their positions to trapped retail traders.

Why stops are placed below EQL:

  • The manipulation phase specifically targets obvious stop-loss zones.
  • Placing stops just below EQL means you get stopped out during the liquidity raid.
  • This tool places stops further below to survive the manipulation phase.

🎯 The Trading Logic

This analyzer combines these concepts into a systematic approach:

1. FIND EQL (Equal Lows)
   └── Identifies where retail stops are clustered

2. FIND BULLISH FVG (below current price)
   └── Identifies imbalance zone where price should react

3. ENTRY = EQL or FVG zone
   └── Enter when price approaches these levels

4. STOP LOSS = Below EQL (with buffer)
   └── Survives the manipulation/liquidity sweep

5. TAKE PROFITS = Based on next EQH/resistance levels
   └── TP1: Conservative (nearest resistance)
   └── TP2: Moderate (prior swing high)
   └── TP3: Aggressive (next major EQH)

✨ Features

πŸ“Š Core Analysis

  • Fair Value Gap (FVG) Detection: Identifies bullish and bearish imbalances
  • Equal Highs/Lows (EQH/EQL): Detects liquidity zones and stop-hunt levels
  • Swing Point Detection: Finds market structure highs and lows
  • Automatic Trade Plans: Generates Entry, Stop Loss, and 3 Take Profit levels

🌐 Web Interface

  • React + TypeScript Frontend: Modern SPA built with Vite, typed API client
  • Real-time Market Scanner: Monitors 500+ tickers from S&P 500 and Nasdaq 100
  • Interactive Charts: TradingView Lightweight Charts with 2 years of history
  • Live Results: Streaming updates as each ticker is scanned
  • Proximity Filter: Only shows tickers within 1.5% of calculated entry

πŸ“ˆ Backtesting

  • Historical Signal Scanner: Tests strategy across 700+ trading days
  • Performance Metrics: Win rate, P&L, TP1/TP2/TP3 hit rates
  • Chart Snapshots: Generates HTML charts for every trade found

🌐 Live Demo (Heroku)

πŸ”— Live Web Scanner:
https://alpha-radar-b725ddaf6ce0.herokuapp.com/

⚠️ Free-tier Performance Disclaimer
This application is hosted on Heroku's free dyno (Demo Mode).

  • Initial load may take 30–60 seconds due to cold starts
  • Scanner limited to 20 popular tickers with 15-minute intervals
  • For full 500+ ticker scanning, run locally

πŸš€ Quick Start

1. Clone & Setup

git clone https://github.com/jerrylin-23/ict_buy_the_dip.git
cd ict_buy_the_dip

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

2. Build Frontend

cd frontend
npm install
npm run build
cd ..

The build output lands in src/static/ and is served by Flask automatically.

3. Run Web Scanner

source venv/bin/activate
python src/app.py

Open http://127.0.0.1:5001 in your browser.

4. Run Backtest

source venv/bin/activate
python src/run_backtest.py NVDA   # or AAPL, GOOGL, SPY, etc.

Results saved to src/samples/<symbol>_daily_<date>/


πŸ“Š Backtest Results (Dec 2024)

Symbol Trades Win Rate Avg P&L TP1 Hit TP2 Hit TP3 Hit
NVDA 286 74.5% +4.63% 74% 60% 49%
GOOGL 248 77.0% +2.68% 77% 54% 42%
AAPL 221 74.7% +2.38% 75% 60% 43%

πŸ“Έ Example Charts

NVDA 2023-12-20 βœ… WIN (TP3)

NVDA WIN

NVDA 2024-04-11 ❌ LOSS (SL)

NVDA LOSS

πŸ“ Browse all 700+ interactive charts: src/samples/


πŸ“ Project Structure

alpha-radar/
β”œβ”€β”€ frontend/              # React + TypeScript SPA (Vite)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ App.tsx         # Main application component
β”‚   β”‚   β”œβ”€β”€ api.ts          # Typed Flask API client
β”‚   β”‚   β”œβ”€β”€ index.css       # Design system & styles
β”‚   β”‚   └── main.tsx        # Entry point
β”‚   β”œβ”€β”€ vite.config.ts      # Build config (outputs to src/static/)
β”‚   └── package.json
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app.py              # Flask web application
β”‚   β”œβ”€β”€ ict_analyzer.py     # Core ICT analysis logic
β”‚   β”œβ”€β”€ db.py               # PostgreSQL persistence (optional, auto-fallback)
β”‚   β”œβ”€β”€ static/             # Vite build output (served by Flask)
β”‚   β”œβ”€β”€ run_backtest.py     # Backtesting script
β”‚   β”œβ”€β”€ tickers.txt         # Watchlist (S&P 500 + Nasdaq 100)
β”‚   β”œβ”€β”€ templates/          # Legacy HTML templates (fallback)
β”‚   └── samples/            # Backtest output (charts & summaries)
β”œβ”€β”€ requirements.txt        # Python dependencies
β”œβ”€β”€ generate_tickers.py     # Script to regenerate watchlist
└── README.md

πŸ› οΈ Configuration

Watchlist

Edit src/tickers.txt to customize the scanner watchlist:

AAPL
NVDA
TSLA
# Add your tickers here

Environment Variables

Variable Default Description
DEMO_MODE false Set to true for limited scanning (20 tickers, 15-min intervals)
DATABASE_URL (unset) PostgreSQL connection string. If set, scan results persist to Postgres; otherwise the app falls back to an in-memory cache automatically.

Scanner Sensitivity

In src/app.py, adjust the near_entry threshold (default: 1.5%):

'near_entry': bool(0 <= dist_pct <= 0.015)

πŸ“‹ Requirements

  • Python 3.10+
  • Node.js 18+ (for frontend build only)
  • Flask
  • yfinance
  • pandas
  • numpy
pip install -r requirements.txt

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


⚠️ Disclaimer

This tool is for educational purposes only. It is not financial advice. Trading involves substantial risk of loss. Always do your own research and consult with a licensed financial advisor before making investment decisions.

The concepts explained here are interpretations of publicly available ICT methodology. This project is not affiliated with or endorsed by Inner Circle Trader.

About

Algorithmic trading scanner that detects ICT (Inner Circle Trader) concepts liquidity pools, fair value gaps, market structure to generate high-probability trade plans via a live web UI.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages