OrderFlow Analysis Pro
Order flow analysis with Bybit + MT5 feeds -- footprint charts, delta analytics, volume profile, pattern detection, Dash dashboard with WebSocket
Install / Use
npx skills add mahmoud20138/OrderFlow-Analysis-ProInstalls into whichever agent you are using.
README
OrderFlow Analysis Pro
Real-time orderflow trading system — tick-level microstructure analysis, 5 pattern detectors, volume profile framing, state machine trade lifecycle, dual data feeds (MT5 + Bybit), FastAPI dashboard with WebSocket, Telegram alerts. Built on Fabio Testa's methodology.
Table of Contents
- What Is OrderFlow Analysis?
- System Overview
- Architecture
- The 5 Core Patterns
- Volume Profile Framing
- State Machine Trade Lifecycle
- Supported Instruments (29)
- Data Sources
- Dashboard
- Telegram Alerts
- Database
- Installation
- Configuration
- Usage
- Project Structure
- File Inventory
- API Reference
- Demo Mode
- Signal Output Examples
- How Pattern Detection Works
- Composite Scoring System
- Contributing
- License
- Disclaimer
What Is OrderFlow Analysis?
OrderFlow analysis reads market microstructure — the tick-by-tick footprint of buyers and sellers — to understand who is in control before price reflects it. Unlike traditional technical analysis that looks at candles and indicators, orderflow looks inside the candle:
Traditional Analysis OrderFlow Analysis
───────────────────── ─────────────────────
Looks at: OHLC candles Looks at: Every tick (price + volume + side)
Timeframe: 1m, 5m, 1H Timeframe: Tick-level (milliseconds)
Answers: What happened? Answers: WHO did it and WHY?
Indicators: RSI, MACD, MA Engines: Delta, Footprint, Volume Profile, Orderbook
Lagging: Yes (averages) Leading: No (real-time microstructure)
Key Concepts
| Concept | What It Measures | Why It Matters | |---------|-----------------|----------------| | Delta | Buy volume minus sell volume per candle/level | Who is aggressive — buyers or sellers? | | Cumulative Delta | Running total of delta over time | Is buying/selling pressure building or fading? | | Footprint | Volume at each price level split by bid/ask | Where did the heavy trading happen inside the candle? | | Volume Profile | Total volume traded at each price over a session | Where is the "fair value" — POC, VAH, VAL? | | Orderbook | Limit orders waiting at each price level | Where are the walls? Thin levels = easy to sweep. | | Absorption | Aggressive volume with no price movement | Someone is defending a level with limit orders. | | Initiative | Aggressive volume WITH price movement | Institutional conviction pushing price. |
System Overview
┌─────────────────────────────────────────────────────────────────────────────┐
│ OrderFlow Analysis Pro │
│ │
│ ┌──────────────────────┐ ┌──────────────────────────────────────┐ │
│ │ DATA SOURCES │ │ ANALYTICS ENGINES (per instrument) │ │
│ │ │ │ │ │
│ │ ┌────────┐ ┌──────┐ │ │ Volume Profile ── POC, VAH, VAL, │ │
│ │ │ MT5 │ │Bybit │ │────▶│ Delta Engine ── vertical, horiz,│ │
│ │ │ Feed │ │ Feed │ │ │ Footprint ── bid/ask/level, │ │
│ │ └────────┘ └──────┘ │ │ Orderbook ── L2 depth, thin │ │
│ └──────────────────────┘ └───────────────┬──────────────────────┘ │
│ │ │
│ ┌────────────────────────────────────────────▼──────────────────────────┐ │
│ │ 5 PATTERN DETECTORS │ │
│ │ Absorption · Initiative · Sweep · Exhaustion · Divergence │ │
│ └────────────────────────────────────────────┬──────────────────────────┘ │
│ │ │
│ ┌────────────────────────────────────────────▼──────────────────────────┐ │
│ │ SIGNAL PROCESSING │ │
│ │ Profile Framing (P/b/D shapes) → Qualified Levels → Daily Bias │ │
│ │ Signal Aggregator (state machine) → Composite Score (0-100) │ │
│ └────────────┬──────────────────────────────────┬───────────────────────┘ │
│ │ │ │
│ ┌────────────▼──────────┐ ┌───────────────────▼────────────────────┐ │
│ │ Telegram Alerts │ │ FastAPI Dashboard │ │
│ │ Entry/BE/Trail/Exit │ │ 16 REST endpoints + WebSocket │ │
│ │ Daily Bias updates │ │ Charts, VP, Footprint, Orderbook │ │
│ └───────────────────────┘ │ Scanner, Strategy Status, Tape │ │
│ └───────────────────────────────────────┘ │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ SQLite Database (WAL mode) │ │
│ │ ticks · candles · volume_profiles · signals · trade_journal │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Architecture
Data Flow Pipeline
┌─────────────┐
│ MT5 Feed │──── Tick polling (100ms)
│ (495L) │──── Market Book (DOM)
│ │──── Historical download
└──────┬──────┘
│
┌──────────────┐ │ ┌──────────────┐
│ Bybit Feed │───────┤ │ Database │
│ (209L) │ ├──────▶│ (278L) │
│ WebSocket │ │ │ SQLite WAL │
│ Free, no key│ │ └──────────────┘
└──────────────┘ │
▼
┌─────────────────┐
│ Candle Builder │ ← Tick → 1m aggregation
│ (133L) │ ← Footprint per level
└────────┬────────┘
│
┌─────────────┼──────────────┐
▼ ▼ ▼
┌──────────────┐ ┌──────────┐ ┌──────────────┐
│ Volume Prof. │ │ Delta │ │ Footprint │
│ Engine (258L)│ │Engine │ │ Engine │
│ │ │ (197L) │ │ (181L) │
│ POC/VAH/VAL │ │ Vert/Hor│ │ Bid/Ask/Lvl │
│ LVN/Shape │ │ Cumul. │ │ Imbalance │
└──────┬───────┘ └────┬─────┘ └──────┬───────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────┐
│ ORDERBOOK TRACKER (208L) │
│ L2 depth · Thin levels · Consumptions │
│ Path of least resistance │
└──────────────────┬──────────────────────┘
│
┌───────┬───────┼───────┬───────┬───────┐
▼ ▼ ▼ ▼ ▼ │
┌────────┐┌────────┐┌──────┐┌────────┐┌────────┐
│Absorp- ││Initia- ││Sweep ││Exhaus- ││Diverg- │
│tion ││tive ││ ││tion ││ence │
│(257L) ││(133L) ││(142L)││(228L) ││(159L) │
└───┬────┘└───┬────┘└──┬───┘└───┬────┘└───┬────┘
│ │ │ │ │
└─────────┴────┬───┴────────┴─────────┘
▼
┌─────────────────────┐
│ Profile Framing │ ← P/b/D shape → Daily Bias
│ (343L) │ ← Qualified Levels (VAH/VAL/POC/LVN/Merged)
└─────────┬───────────┘
▼
┌─────────────────────┐
│ Signal Aggregator │ ← State machine (6 states)
│ (516L) │ ← Composite scoring (0-100)
│ │ ← SL/TP calculation
└──────┬──────────────┘
│
┌───────────┼───────────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌───────────────┐
│ Telegram │ │Dashboard │ │ Database │
│ Bot │ │ FastAPI │ │ Journal │
│ (202L) │ │ (1015L) │ │ Logging │
└──────────┘ └──────────┘ └───────────────┘
Module Dependency Graph
main.py (666L) ─── System orchestrator
│
├── config/settings.py (946L) ─── 29 instrument configs, 10 config dataclasses
│
├── data/
│ ├── models.py (290L) ─── 7 dataclasses: Tick, Candle, Signal, TradeState...
│ ├── candle_builder.py (133L) ─── Tick → 1m aggregation + footprint
│ ├── mt5_feed.py (495L) ─── MT5 terminal: ticks, book, history
│ ├── bybit_feed.py (209L) ─── Bybit WebSocket: trades + orderbook
│ └── database.py (278L) ─── SQLite: 5 tables, WAL mode
│
├── analytics/
│ ├── volume_profile.py (258L) ─── POC/VAH/VAL/LVN/shape
│ ├── delta.py (197L) ─── Vertical + horizontal + cumulative de
Related Skills
python-debugpy
385.6kDebug Python with pdb, breakpoint(), post-mortem inspection, and debugpy remote attach.
skill-creator
385.6kCreate, edit, audit, tidy, validate, or restructure AgentSkills and SKILL.md files.
claude-opus-4-5-migration
140.7kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
automl-hyperparameter-optimization
40.5kAutoML and hyperparameter optimization rules for Python ML projects using Ray Tune, Optuna, PyCaret, and time-series AutoML libraries
