Order flow analysis with Bybit + MT5 feeds -- footprint charts, delta analytics, volume profile, pattern detection, Dash dashboard with WebSocket
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 ยท volumeprofiles ยท signals ยท tradejournal โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
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 delta
โ โโโ footprint.py (181L) โโโ Bid/ask per level, imbalance detection
โ โโโ orderbook.py (208L) โโโ L2 depth, thin levels, consumption tracking
โ
โโโ patterns/
โ โโโ absorption.py (257L) โโโ Effort >> result detection
โ โโโ initiative.py (133L) โโโ Effort = result (momentum)
โ โโโ sweep.py (142L) โโโ Thin book displacement
โ โโโ exhaustion.py (228L) โโโ Declining volume at extremes
โ โโโ divergence.py (159L) โโโ Price vs delta disagreement
โ
โโโ signals/
โ โโโ profile_framing.py (343L) โโโ Daily bias + qualified levels
โ โโโ aggregator.py (516L) โโโ State machine + composite scoring
โ
โโโ alerts/
โ โโโ telegram_bot.py (202L) โโโ Telegram notifications
โ
โโโ dashboard/
โโโ app.py (1015L) โโโ FastAPI REST + WebSocket server
โโโ websocket_manager.py (186L) โโโ 9-channel broadcast with throttling
โโโ demo_data.py (782L) โโโ Deterministic demo data generator
โโโ main.py (35L) โโโ Standalone launcher
โโโ static/ โโโ HTML/JS/CSS frontend (8 files, 4,420L)
The 5 Core Patterns
The system detects 5 microstructure patterns based on Fabio Testa's methodology. Each outputs a strength score (0-100) and directional bias (BUY/SELL).
Pattern Overview
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 5 PATTERN DETECTORS โ
โ โ
โ 1. ABSORPTION 2. INITIATIVE 3. SWEEP โ
โ Effort >> Result Effort = Result Thin Book Displacement โ
โ โโโโโโโโโโ โโโโโโโโโโ โโโโโโ โ
โ โโโโโโโโโโ (no โโโโโโโโโโ (price โโโโโโโโโ (price โ
โ โโโโโโโโโโ move) โโโโโโโโโโ moves) โโโโโโโโ moves fast) โ
โ Buyers/Sellers Directional Low volume โ
โ defending level conviction through empty levels โ
โ โ
โ 4. EXHAUSTION 5. DIVERGENCE โ
โ Declining Effort Price vs Delta Disagreement โ
โ โโ โ โ Price: โโโ NEW HIGH โ
โ โ โ โ Delta: โโโ (failing) โ
โ โ โ โ Trend reversal warning โ
โ โ โ โ โ
โ Volume fading โ
โ at extremes โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Detection Details
| # | Pattern | Detection Logic | Source Data | Signal Purpose | |---|---------|----------------|-------------|----------------| | 1 | Absorption | 2 methods: (a) Delta/price mismatch โ positive delta + red candle = sellers absorbing, (b) High volume at level + low displacement + repeated attempts | Delta, Footprint, Price | Entry signal at VAH/VAL | | 2 | Initiative | 5 criteria: delta โฅ threshold, volume โฅ 1.5x average, body โฅ 3 ticks, delta/price aligned, one-sided imbalance bonus | Delta, Footprint, Volume | Break-even / trail trigger | | 3 | Sweep | Price through โฅ3 thin orderbook levels + low volume per level + thin book confirmation (โฅ2 thin levels on swept side) | Orderbook, Price | Liquidity grab / reversal alert | | 4 | Exhaustion | Price trending + volume declining >30% + negative volume/delta trend + optional contrarian imbalance at extreme | Volume trend, Delta ROC, Footprint | Exit warning โ momentum fading | | 5 | Divergence | Price new high/low but cumulative delta peak/trough fails to confirm (<80% of prior) | Price, Cumulative Delta peaks | Trend reversal warning |
Strength Score Calculation
| Pattern | Score Formula | Range | |---------|--------------|-------| | Absorption | (volume / minaggressive) 40 or (vol / minaggressive) 30 + attempts * 15 | 0-75 | | Initiative | (delta/threshold)20 + volaccel15 + bodyticks5 + imbalance_count10 | 0-50+ | | Sweep | levels15 + efficiency20 + displacement1000 + thin_confirm15 | 30-100 | | Exhaustion | 40 + |voltrend|5 + |deltaroc|5 + contrarian_bonus(20) | 40-70 | | Divergence | 30 + (1 - ratio)40 + pricenewextreme10 | 30-80 |
Volume Profile Framing (Daily Bias)
Implements Fabio Testa's profile shape analysis to determine the daily directional bias and identify qualified levels to trade from.
Profile Shapes
P-SHAPE (Buyers in Control) b-SHAPE (Sellers in Control)
Volume โ Volume โ
โ โ โ โ
โโ โ โ โโ
โโโ โ POC > 65% โ โโโ POC < 35%
โโโโ โ Bias: LONG โ โโโโ Bias: SHORT
โโโโโโ โ โโโโโโ
โโโโโโโโผโโโโโโโโโโ Price โโโโโโโผโโโโโโโโโโ Price
VAL โ POC VAH VAH POC VAL
D-SHAPE (Balanced) DOUBLE DISTRIBUTION Volume โ Volume โ โ โ โ โ โโโโ โโโโ โโ โ โโ โ โโโโ โโโโ โโโ โ โโโ POC ~50% โ โโโโโโโโโโ (valley) โโโโ โ โโโโ Bias: NEUTRAL โ โโโโ โโโโ Bias: TRANSITION โโโโโโโโผโโโโโโโโโโ Price โโโโโโโผโโโโโโโโโโโโโโโโโโ Price VAL โ POC โ VAH VAHโ VALโ VAHโ VALโ
| Shape | POC Position | Bias | Confidence Base | Trading Plan | |-------|-------------|------|----------------|-------------| | P-shape | >65% from bottom | LONG | 40 + poc_pctร30 | Buyers in control, buy dips to VAL | | b-shape | <35% from bottom | SHORT | 40 + (1-poc_pct)ร30 | Sellers in control, sell rallies to VAH | | D-shape | ~50% | NEUTRAL | 20 | Balanced, fade extremes | | Double Distribution | Bimodal (valley <50% of peaks) | NEUTRAL | 30 | Transition โ watch for breakout |
Qualified Levels
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ QUALIFIED LEVELS (Trade From These) โ
โ โ
โ Price โฒ โ
โ โ โโโโ VAH (Value Area High) โโโ SELL ZONE โ
โ โ โ โ
โ โ โ โโโ MERGED VAH โโโ Strong SELL (str=70) โ
โ โ โ โ (confluent across multiple days) โ
โ โ โ โ
โ โ โ โโโ LVN (Low Volume Node) โโโ Rebalancing โ
โ โ โ โ (price magnet โ gaps fill fast) โ
โ โ โ โ โ
โ โ โโโโค โ โโโ POC (Point of Control) โโโ Pivot โ
โ โ โ โ โ โ (highest volume = fair value) โ
โ โ โ โ โ โ โ
โ โ โ โโโโค โ โโโ MERGED VAL โโโ Strong BUY (str=70) โ
โ โ โ โ โ โ โ (confluent across multiple days) โ
โ โ โ โ โ โ โ โ
โ โ โโโโค โ โ โ โโโ VAL (Value Area Low) โโโ BUY ZONE โ
โ โ โ โ โ โ
โ โโโโโโโ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ Confluence Bonus: +20 strength when level matches across days โ
โ Multi-day merge: overlapping profiles (>30% VA overlap) merged โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Multi-Day Context Checks
| Check | What It Does | Effect | |-------|-------------|--------| | Value accepted higher | Current VA above prior VA | +15 confidence if aligned with bias | | VAH rejection | Price rejected at VAH across multiple days | Bias โ WARNING, -10 penalty to composite score | | Failed auction ("hooks") | Bullish hook below VAL, bearish hook above VAH | Reduces confidence |
State Machine Trade Lifecycle
Every instrument runs an independent state machine. The system watches qualified levels, detects absorption entries, manages the trade through break-even and trailing stops, and auto-closes on strong exit signals.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ STATE MACHINE TRADE LIFECYCLE โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ NO ACTIVE TRADE โ โ
โ โ Price approaches qualified level (strength >= 50) โ โ
โ โ Aggregator auto-watches level โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ WATCHING โ โ
โ โ Monitoring level for absorption or sweep signals โ โ
โ โโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ABSORPTION detected โ SWEEP detected โ
โ โ (composite >= 40) โ (thin book displacement) โ
โ โผ โผ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ABSORPTION โ โ ALERT ONLY โ โ
โ โ DETECTED โ โ (sweep notification, โ โ
โ โ (transient) โ โ no entry) โ โ
โ โโโโโโโโฌโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Entry signal sent, SL/TP calculated โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ POSITION_OPEN โ โ
โ โ Trade entered. Waiting for initiative (BE trigger) โ โ
โ โ OR watching for exit warnings (exhaustion/divergence) โ โ
โ โโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโ โ
โ โ INITIATIVE (same dir) โ EXIT WARNING (opposite dir) โ
โ โ Move SL to entry price โ str >= 70 โ auto-close โ
โ โผ โผ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ BREAK_EVEN โ โ CLOSED โ โ
โ โ SL = entry โ โ (auto-close on strong โ โ
โ โ Risk-free โ โ exit signal) โ โ
โ โโโโโโโโฌโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ INITIATIVE (same dir) โ
โ โ Trail SL to candle extreme โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ TRAILING โ โ
โ โ SL trails to candle low (longs) or high (shorts) โ โ
โ โ Each new initiative print moves the trail โ โ
โ โโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโ โ
โ โ More INITIATIVE โ EXIT WARNING (str>=70) โ
โ โ Keep trailing โ or SL hit โ
โ โผ โผ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ (loop back) โ โ CLOSED โ โ
โ โ TRAILING โโโโโโโโโโโโโโโโถโ Trade logged to โ โ
โ โ โ โ journal + Telegram โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Supported Instruments (29)
Each instrument has pre-tuned thresholds for all 5 pattern detectors, optimized for its volatility and tick size.
Index Futures (9)
| Instrument | Tick Size | Absorption Min Vol | Initiative Min Delta | VP Tick Size | Session | |-----------|-----------|-------------------|---------------------|-------------|---------| | NAS100 | 0.1 | 50 | 30 | 1.0 | NY Cash | | SP500 | 0.1 | 40 | 25 | 1.0 | NY Cash | | DJ30 | 1.0 | 40 | 25 | 5.0 | NY Cash | | UK100 | 0.1 | 30 | 20 | 1.0 | London | | DAX40 | 0.1 | 30 | 20 | 2.0 | London | | NIKKEI225 | 1.0 | 30 | 20 | 50.0 | Asian | | CAC40 | 0.1 | 25 | 18 | 1.0 | London | | ASX200 | 0.1 | 25 | 18 | 1.0 | Asian | | HK50 | 1.0 | 25 | 18 | 5.0 | Asian |
Metals, Energy, Crypto
| Instrument | Category | Tick Size | VP Tick Size | Session | |-----------|----------|-----------|-------------|---------| | XAUUSDT (Gold) | Metal | 0.01 | 0.50 | NY Cash | | XAGUSD (Silver) | Metal | 0.001 | 0.05 | Full Day | | USOIL | Energy | 0.01 | 0.10 | NY Cash | | UKOIL | Energy | 0.01 | 0.10 | London | | BTCUSDT | Crypto | 0.01 | 10.0 | Full Day |
Forex (10 Pairs)
| Instrument | Tick Size | VP Tick Size | Session | |-----------|-----------|-------------|---------| | EURUSD | 0.00001 | 0.0005 | Full Day | | GBPUSD | 0.00001 | 0.0005 | Full Day | | USDJPY | 0.001 | 0.05 | Full Day | | AUDUSD | 0.00001 | 0.0005 | Full Day | | USDCAD | 0.00001 | 0.0005 | Full Day | | USDCHF | 0.00001 | 0.0005 | Full Day | | NZDUSD | 0.00001 | 0.0005 | Full Day | | EURGBP | 0.00001 | 0.0005 | Full Day | | EURJPY | 0.001 | 0.05 | Full Day | | GBPJPY | 0.001 | 0.05 | Full Day |
US Stocks (7)
| Instrument | Tick Size | VP Tick Size | Session | |-----------|-----------|-------------|---------| | AAPL | 0.01 | 0.50 | NY Cash | | TSLA | 0.01 | 0.50 | NY Cash | | AMZN | 0.01 | 0.50 | NY Cash | | MSFT | 0.01 | 0.50 | NY Cash | | NVDA | 0.01 | 0.50 | NY Cash | | META | 0.01 | 0.50 | NY Cash | | GOOGL | 0.01 | 0.50 | NY Cash |
Data Sources
Dual Feed Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ DATA SOURCE OPTIONS โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ MT5 FEED โ โ BYBIT FEED โ โ
โ โ โ โ โ โ
โ โ Source: MT5 terminalโ โ Source: Bybit WebSocketโ โ
โ โ Requires: Account โ โ Requires: Nothing โ โ
โ โ Ticks: 100ms pollingโ โ Ticks: Real-time streamโ โ
โ โ Orderbook: DOM data โ โ Orderbook: 50 levels โ โ
โ โ History: Up to 3 daysโ โ History: None โ โ
โ โ Aggressor: Buy/Sell โ โ Aggressor: Trade side โ โ
โ โ flag from MT5 โ โ from Bybit API โ โ
โ โโโโโโโโโโโโฌโโโโโโโโโโโโ โโโโโโโโโโโโโฌโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โ DATA_SOURCE = "MT5" โ "BYBIT" โ
โ โ DATA_SOURCE = "BOTH" โโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Symbol Auto-Discovery (MT5) โ โ
โ โ 200+ broker-specific name variants โ โ
โ โ e.g. USTEC, USTECm, NAS100, US100 โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
MT5 Symbol Mapping
The system auto-discovers instruments across 200+ broker-specific naming variants:
| Internal | MT5 Symbol | Alternatives | |----------|-----------|-------------| | NAS100 | USTECm | USTEC, NAS100, US100, NQ100, NAS100USD... | | XAUUSDT | XAUUSDm | XAUUSD, GOLD... | | EURUSD | EURUSDm | EURUSD, EUR/USD... | | BTCUSDT | BTCUSDm | BTCUSD, BTC/USD... |
Dashboard
Frontend Components (8 custom JS modules)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ORDERFLOW DASHBOARD โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ PRICE CHART (app.js) โ โ VOLUME PROFILE โ โ
โ โ TradingView lightweight-charts โ โ Horizontal bars โ โ
โ โ Signal markers overlay: โ โ POC, VAH, VAL marks โ โ
โ โ โฒ Absorption (teal) โ โ Shape classification โ โ
โ โ โฒ Initiative (green) โ โ LVN markers โ โ
โ โ โฒ Sweep (purple) โ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ Exhaustion (yellow) โ
โ โ โ Divergence (orange) โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ Entry/Exit markers โ FOOTPRINT CHART โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Bid/Ask per level โ โ
โ โ Imbalance highlights โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ SIGNAL CARDS (signals.js) โ โ
โ โ Real-time trade recommendations โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ Entry/SL/TP/RR display โ โ ORDERBOOK DEPTH โโ
โ โ Pattern breakdown โ โ Bid/Ask ladder โโ
โ โ Grade (A+/A/B/C) โ โ Thin level markers โโ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ Spread indicator โโ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ PERFORMANCE (performance.js) โ โ TIME & SALES (tape.js)โโ
โ โ Win rate, PnL, RR distribution โ โ Tick-by-tick feed โโ
โ โ Trade history โ โ Big trade highlights โโ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ MICROSTRUCTURE (microstructure.js) โ โ
โ โ Market state ยท Session ยท Absorption ยท Delta ยท Exhaustion โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
WebSocket Channels (9)
| Channel | Data | Throttle | Priority | |---------|------|----------|----------| | tick | Price, size, side | 200ms | High | | candle | OHLCV + delta | None (immediate) | Critical | | signal | AggregatedSignal | None (immediate) | Critical | | trade_state | TradePhase transitions | None (immediate) | Critical | | volume_profile | POC/VAH/VAL/shape | None | Normal | | bias | DailyBias updates | None | Normal | | orderbook | L2 depth + imbalance | 500ms | Normal | | delta | Cumulative delta history | 200ms | Normal | | stats | System-wide per-instrument | 5000ms | Low |
Telegram Alerts
Automated notifications for every trade lifecycle event:
| Alert Type | Trigger | Content | |-----------|---------|---------| | ENTRY SIGNAL | Absorption at qualified level, composite โฅ40 | Direction, score, pattern, delta, volume, bias, entry/SL/TP/RR | | BREAK EVEN | First initiative auction after entry | SL moved to entry price โ risk-free trade | | TRAIL UPDATE | Subsequent initiative prints | New SL level, trail progress | | EXIT SIGNAL | Trade closed (SL hit or auto-close) | PnL ticks, RR achieved, trade summary | | EXIT WARNING | Exhaustion or divergence detected | Pattern details, strength, direction warning | | DAILY BIAS | New VP shape computed | Shape, direction, confidence, POC/VAH/VAL, qualified levels |
Database
SQLite Schema (5 Tables)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ orderflow_data.db (WAL mode) โ
โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ ticks โ โ candles โ โ volume_profilesโ โ signals โ โ
โ โโโโโโโโโโโโค โโโโโโโโโโโโค โโโโโโโโโโโโโโโโโโค โโโโโโโโโโโโค โ
โ โ id (PK) โ โ id (PK) โ โ id (PK) โ โ id (PK) โ โ
โ โinstrumentโ โinstrumentโ โ instrument โ โinstrumentโ โ
โ โtimestamp โ โtimestamp โ โ session_date โ โtimestamp โ โ
โ โ price โ โtimeframe โ โ poc, vah, val โ โsig_type โ โ
โ โ size โ โ OHLCV โ โ total_volume โ โdirection โ โ
โ โ side โ โ buy/sell โ โ shape โ โprice_lvl โ โ
โ โ tradeid โ โ delta โ โ pocpos_pct โ โ strength โ โ
โ โโโโโโโโโโโโ โfootprint โ โ lvn (JSON) โ โdetails โ โ
โ โโโโโโโโโโโโ โ volatprice โ โ (JSON) โ โ
โ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโโโโ โ
โ โ trade_journalโ โ
โ โโโโโโโโโโโโโโโโค โ
โ โ id (PK) โ โ
โ โ instrument โ โ
โ โ direction โ โ
โ โ entry/exit โ โ
โ โ time (ms) โ โ
โ โ entry/exit โ โ
โ โ price โ โ
โ โ SL, TP โ โ
โ โ pnl_ticks โ โ
โ โ rr_ratio โ โ
โ โ signals(JSON)โ โ
โ โ notes โ โ
โ โโโโโโโโโโโโโโโโ โ
โ โ
โ Indexes: (instrument, timestamp), (instrument, session_date) โ
โ PRAGMA: journal_mode=WAL, synchronous=NORMAL โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Installation
Prerequisites
- Python 3.10+
- MetaTrader 5 terminal (for MT5 feed) OR Bybit (free, no account needed)
Setup
# Clone the repository
git clone https://github.com/mahmoud20138/OrderFlow-Analysis-Pro.git
cd OrderFlow-Analysis-Pro
Install dependencies
pip install -e .
Or install manually
pip install websockets aiohttp pandas numpy scipy \
python-telegram-bot plotly kaleido aiosqlite pytz pyyaml
Quick Start (Bybit โ No Account Needed)
# 1. Set data source to BYBIT in config
2. Run the system
python -m orderflow_system.main
3. Open dashboard
http://localhost:8080
Quick Start (MT5)
# 1. Open MetaTrader 5 terminal
2. Configure credentials in config/settings.py
3. Run the system
python -m orderflow_system.main
Dashboard Only (Demo Mode)
# Run dashboard with deterministic demo data
python -m orderflow_system.dashboard
Configuration
All configuration is in orderflow_system/config/settings.py:
# Data source: "MT5", "BYBIT", or "BOTH"
DATA_SOURCE = DataSource.BYBIT
MT5 credentials (only if using MT5 feed)
MT5 = MT5Config(
login=12345678,
password="your_password",
server="YourBroker-Server",
pollintervalms=100, # Tick polling frequency
enable_book=True, # Enable market book (DOM)
downloadhistorydays=3, # Download M1 history for warmup
)
Telegram alerts
TELEGRAM = TelegramConfig(
bottoken="yourbot_token",
chatid="yourchat_id",
sendchartsnapshots=True,
)
Dashboard
DASHBOARD = DashboardConfig(
enabled=True,
host="0.0.0.0",
port=8080,
log_level="warning",
)
Database
DBPATH = "orderflowdata.db"
LOG_LEVEL = "INFO"
Per-Instrument Threshold Tuning
Each instrument has its own config with tuned thresholds. Example for NAS100:
AbsorptionConfig(
minaggressivevolume=50, # Min volume to qualify as absorption
maxpricedisplacement_ticks=2, # Max ticks price can move
rollingwindowseconds=30, # Lookback window
min_attempts=2, # Min repeated attempts at level
bigtradefilter=10, # Volume threshold for "big" trade
)
InitiativeConfig( mindeltathreshold=30, # Min delta to qualify volumeaccelerationmin=1.5, # Must be 1.5x average volume minpricedisplacement_ticks=3, # Min body size deltapricealignment=True, # Delta must align with candle direction )
Usage
Start the System
python -m orderflow_system.main
The system will:
- Connect to configured data source(s)
- Download historical bars (MT5) or connect to live feed (Bybit)
- Build initial volume profiles from historical data
- Start 5 pattern detectors for all 29 instruments
- Compute daily bias and qualified levels
- Auto-watch strong levels (strength โฅ 50)
- Begin state machine monitoring
- Send Telegram alerts on signals
- Serve dashboard at
http://localhost:8080
Dashboard Endpoints
# View all instruments
curl http://localhost:8080/api/instruments
Get scanner ranking (all pairs by trade proximity)
curl http://localhost:8080/api/scanner
Get strategy status for NAS100
curl http://localhost:8080/api/strategy-status/NAS100USDT
Get volume profile
curl http://localhost:8080/api/volume-profile/NAS100USDT?days=5
Get daily bias
curl http://localhost:8080/api/bias/NAS100USDT
Get signal history
curl http://localhost:8080/api/signals/NAS100USDT?limit=50
Get active trade state
curl http://localhost:8080/api/trade/NAS100USDT
Project Structure
orderflow_system/
โโโ main.py # System orchestrator (666L)
โโโ init.py # Package init
โโโ test_integration.py # Integration tests (314L)
โ
โโโ config/
โ โโโ settings.py # 29 instrument configs, 10 config dataclasses (946L)
โ
โโโ data/
โ โโโ models.py # 7 dataclasses: Tick, Candle, Signal, TradeState... (290L)
โ โโโ candle_builder.py # Tick โ 1m candle aggregation (133L)
โ โโโ bybit_feed.py # Bybit WebSocket feed (209L)
โ โโโ mt5_feed.py # MT5 terminal feed with auto-discovery (495L)
โ โโโ database.py # SQLite persistence, 5 tables (278L)
โ
โโโ analytics/
โ โโโ volume_profile.py # POC, VAH, VAL, LVN, shape classification (258L)
โ โโโ delta.py # Vertical, horizontal, cumulative delta (197L)
โ โโโ footprint.py # Bid/ask per level, imbalance detection (181L)
โ โโโ orderbook.py # L2 depth, thin levels, consumption tracking (208L)
โ
โโโ patterns/
โ โโโ absorption.py # Effort >> result detection (257L)
โ โโโ initiative.py # Effort = result (momentum) (133L)
โ โโโ sweep.py # Thin book displacement (142L)
โ โโโ exhaustion.py # Declining volume at extremes (228L)
โ โโโ divergence.py # Price vs delta disagreement (159L)
โ
โโโ signals/
โ โโโ profile_framing.py # Daily bias + qualified levels (343L)
โ โโโ aggregator.py # State machine + composite scoring (516L)
โ
โโโ alerts/
โ โโโ telegram_bot.py # Telegram notifications (202L)
โ
โโโ dashboard/
โโโ app.py # FastAPI REST + WebSocket (1015L)
โโโ websocket_manager.py # 9-channel broadcast manager (186L)
โโโ demo_data.py # Deterministic demo data generator (782L)
โโโ main.py # Standalone launcher (35L)
โโโ static/
โโโ index.html # Main HTML shell (121L)
โโโ app.js # TradingView charts + WebSocket (939L)
โโโ style.css # Dashboard styling (566L)
โโโ footprint.js # Canvas footprint chart (700L)
โโโ signals.js # Signal recommendation cards (479L)
โโโ performance.js # Performance analytics (599L)
โโโ orderbook.js # Orderbook depth ladder (318L)
โโโ microstructure.js # Microstructure indicators (417L)
โโโ tape.js # Time & sales (281L)
File Inventory
| Category | Files | Python Lines | JS/CSS/HTML Lines | Total Lines | |----------|-------|-------------|-------------------|-------------| | Config | 1 | 946 | โ | 946 | | Data | 5 | 1,405 | โ | 1,405 | | Analytics | 4 | 844 | โ | 844 | | Patterns | 5 | 919 | โ | 919 | | Signals | 2 | 859 | โ | 859 | | Alerts | 1 | 202 | โ | 202 | | Dashboard | 4 + 8 static | 1,818 | 4,420 | 6,238 | | Main + Tests | 2 | 980 | โ | 980 | | Total | ~32 | ~7,973 | ~4,420 | ~12,393 |
API Reference
REST Endpoints (16)
| Method | Endpoint | Description | |--------|----------|-------------| | GET | / | Dashboard UI | | GET | /api/instruments | Active instruments with stats + trade phase | | GET | /api/scanner | All pairs ranked by trade proximity (priority 0-118) | | GET | /api/markers/{symbol} | TradingView chart markers for signal events | | GET | /api/candles/{symbol} | OHLCV candle history (params: count, tf, range) | | GET | /api/volume-profile/{symbol} | Volume profile with POC/VAH/VAL (params: days, range) | | GET | /api/bias/{symbol} | Daily bias + qualified levels | | GET | /api/signals/{symbol} | Signal history (params: limit) | | GET | /api/trade/{symbol} | Active trade state | | GET | /api/strategy-status/{symbol} | 6-step Fabio methodology checklist | | GET | /api/orderbook/{symbol} | Current L2 orderbook (params: levels) | | GET | /api/delta/{symbol} | Cumulative delta history (params: count, tf, range) | | GET | /api/footprint/{symbol} | Footprint chart data (params: tf, range) | | GET | /api/tape/{symbol} | Time & sales (params: count) | | GET | /api/microstructure/{symbol} | Microstructure snapshot | | GET | /api/stats | System-wide stats |
Strategy Status Labels
| Status | Meaning | |--------|---------| | NO_DATA | No data received yet | | NO_LEVELS | No qualified levels identified | | WAITINGFORPRICE | Levels exist, price not nearby | | ATLEVELSCANNING | Price near a qualified level | | WATCHING | Aggregator actively watching a level | | ENTRY_READY | Absorption detected, composite score โฅ threshold | | IN_TRADE | Position open | | BREAK_EVEN | SL moved to entry | | TRAILING | SL trailing on initiative | | IDLE | No active monitoring |
Scanner Priority Scoring
| State | Base Score | Bonus | |-------|-----------|-------| | IN_TRADE | 100 | +3 per completed step | | TRAILING | 95 | +3 per completed step | | BREAK_EVEN | 90 | +3 per completed step | | ENTRY_READY | 85 | +3 per completed step | | ATLEVELSCANNING | 70 | +3 per completed step | | WATCHING | 60 | +3 per completed step | | WAITINGFORPRICE | 40 | โ | | NO_LEVELS | 20 | โ | | NO_DATA | 10 | โ | | OFFLINE | 5 | โ | | IDLE | 0 | โ |
Demo Mode
The system includes a deterministic demo data generator that produces realistic data for all 29 instruments โ no data feed required. Runs via:
python -m orderflow_system.dashboard
Generates:
- OHLCV candles via random walk (seeded per symbol/timeframe)
- Volume profiles with Gaussian distributions
- Cumulative delta with bar-level noise
- Orderbooks with ~15% thin levels
- 6 institutional-grade signal templates with narrative, thesis, edge, invalidation, HTF context, session, regime, MTF confluence, blockers, and grade
Signal Quality Grading
| Grade | Score | Meaning | |-------|-------|---------| | A+ | โฅ85 | Exceptional โ multiple confirmations, high confluence | | A | โฅ70 | Strong โ solid pattern + level + bias alignment | | B | โฅ55 | Good โ pattern detected, partial confluence | | C | <55 | Weak โ pattern only, consider skipping |
Signal Output Examples
Entry Signal
ENTRY SIGNAL: NAS100 LONG
Composite Score: 72/100
Pattern: ABSORPTION at VAL (17,845.50)
Delta: +1,250 (buyers absorbing sells)
Volume: 3.2x average
Bias: P-shape (LONG), confidence 85%
Entry: 17,846.00 | SL: 17,830.00 | TP: 17,878.00
R:R: 1:2.0
Grade: A
Daily Bias Update
DAILY BIAS: NAS100
Shape: P-shape (buyers in control)
Direction: LONG | Confidence: 85%
POC: 17,852.00 | VAH: 17,890.00 | VAL: 17,820.00
LVN: [17,835.00, 17,868.00]
Qualified Levels: VAL (buy, str=50), MERGED_VAL (buy, str=70)
Strategy Status
STRATEGY STATUS: NAS100
Step 1: Profile Framing โ P-shape, LONG, 85%
Step 2: Qualified Levels โ VAL=17820, MERGED_VAL=17815
Step 3: Price at Level โ Price 17825 near VAL
Step 4: Absorption Scan โ Detected, strength 72
Step 5: Entry Decision โ Composite 72 โฅ 40
Step 6: Trade Management โณ Waiting for initiative
Overall: ENTRY_READY
How Pattern Detection Works
Absorption Detection (2 Methods)
Method 1: Delta/Close Mismatch
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Delta: +500 (buying) Delta: -400 (selling)
Candle: RED (closed โ) Candle: GREEN (closed โ)
โ SELLERS absorbing โ BUYERS absorbing
โ Signal: SELL โ Signal: BUY
Strength = (|delta| / minaggressivevolume) * 40
Method 2: Level Absorption โโโโโโโโโโโโโโโโโโโโโโโโโโ Track aggressive volume at each price level over rolling window. If volume >= minaggressive AND attempts >= minattempts: โ ABSORPTION signal Strength = (vol / min_aggressive) 30 + attempts 15
Initiative Detection (5 Criteria)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ INITIATIVE = Aggressive Conviction โ
โ โ
โ All 5 must be met: โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ 1. |delta| >= mindeltathreshold (30) โ โ/โ โ
โ โ 2. volume / avg >= volume_accel (1.5x) โ โ/โ โ
โ โ 3. bodysize >= mindisplacement (3 ticks) โ โ/โ โ
โ โ 4. delta direction == candle direction โ โ/โ โ
โ โ 5. Bonus: one-sided imbalance prints (>3.0) โ +10 โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Strength = delta20 + accel15 + body5 + imbalance10 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Composite Scoring System
The SignalAggregator computes a composite score (0-100) that determines whether a signal becomes a trade:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ COMPOSITE SCORE CALCULATION โ
โ โ
โ Signal Weight (varies by pattern): โ
โ โโโโโโโโโโโโโโโโโโฌโโโโโโโโโ โ
โ โ Absorption โ ร0.30 โ โ Highest weight โ
โ โ Divergence โ ร0.25 โ โ
โ โ Initiative โ ร0.20 โ โ
โ โ Sweep โ ร0.20 โ โ
โ โ Other โ ร0.15 โ โ
โ โโโโโโโโโโโโโโโโโโดโโโโโโโโโ โ
โ โ
โ Level Strength: ร0.25 โ
โ Bias Alignment: ร0.20 (if direction matches) โ
โ Bias WARNING: -10 (penalty if VA rejected) โ
โ โ
โ Final: clamped to [0, 100] โ
โ Minimum to enter: 40 (configurable) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
SL/TP Calculation
| Scenario | SL (LONG) | TP (LONG) | SL (SHORT) | TP (SHORT) | |----------|-----------|-----------|------------|------------| | With bias | val - (vah-val)ร0.1 | vah | vah + (vah-val)ร0.1 | val | | No bias | price ร 0.997 (-0.3%) | price ร 1.006 (+0.6%) | price ร 1.003 (+0.3%) | price ร 0.994 (-0.6%) |
Contributing
See CONTRIBUTING.md for guidelines. PRs welcome โ bug fixes, new pattern detectors, additional instruments, dashboard improvements.
License
MIT โ use freely in personal and commercial projects.
Disclaimer
This software is for educational and research purposes only. It is not financial advice. Trading involves substantial risk of loss. Past performance is not indicative of future results. Use at your own risk.