BacktestIQ Architecture: Difference between revisions
Appearance
Created page with "= BacktestIQ – Strategy Simulation Platform Component Architecture = == PART 1: Pipeline Architecture == Pre-aggregated OHLC data (5M, 15M, 1H, 4H, 1D) derived from 1-minute source. At present conversion doesnot happen at runtime, it is done beforehand. data_manager.py just loads pre-converted CSV files. <pre> Raw OHLC Data (1D, 4H, 1H, 15M, 5M) │ ▼ ┌──────────────────────────..." |
No edit summary |
||
| Line 81: | Line 81: | ||
{| class="wikitable" style="width:100%" | {| class="wikitable" style="width:100%" | ||
|- | |- | ||
! # !! Component !! Purpose | ! # !! Component !! Purpose !! Owner | ||
|- | |- | ||
| 1 || [[Component:Multi_Timeframe_Analysis|multi_timeframe_analysis.py]] || MTF alignment across 5 timeframes | | 1 || [[Component:Multi_Timeframe_Analysis|multi_timeframe_analysis.py]] | ||
|| MTF alignment across 5 timeframes | |||
|| Pawan | |||
|- | |- | ||
| 2 || [[Component:Trend_Analysis_Core|trend_analysis_core.py]] || Per-timeframe trend direction, MA slopes | | 2 || [[Component:Trend_Analysis_Core|trend_analysis_core.py]] | ||
|| Per-timeframe trend direction, MA slopes | |||
|| Chayan | |||
|- | |- | ||
| 3 || [[Component:Market_State_Analysis|market_state_analysis.py]] || Railroad, creeper, volatility, trend phase | | 3 || [[Component:Market_State_Analysis|market_state_analysis.py]] | ||
|| Railroad, creeper, volatility, trend phase | |||
|| Vishal | |||
|- | |- | ||
| 4 || [[Component:Setup_Quality_Detection|setup_quality_detection.py]] || 5-factor scoring, A+ to F grades | | 4 || [[Component:Setup_Quality_Detection|setup_quality_detection.py]] | ||
|| 5-factor scoring, A+ to F grades | |||
|| Vishal | |||
|- | |- | ||
| 5 || [[Component:Signal_Generation|signal_generation_trade_management.py]] || Direction, filters, entry/stop/target | | 5 || [[Component:Signal_Generation|signal_generation_trade_management.py]] | ||
|| Direction, filters, entry/stop/target | |||
|| Chayan | |||
|- | |- | ||
| 6 || [[Component:Trade_Execution|trade_execution_engine.py]] || Execution, position management, P&L | | 6 || [[Component:Trade_Execution|trade_execution_engine.py]] | ||
|| Execution, position management, P&L | |||
|| Harshad | |||
|- | |- | ||
| 7 || [[Component:Probability_Zone|probability_zone_analysis.py]] || Probability zones, crash bar [Work in progress] | | 7 || [[Component:Probability_Zone|probability_zone_analysis.py]] | ||
|| Probability zones, crash bar <small>[Work in progress]</small> | |||
|| Rikk | |||
|- | |- | ||
| 8 || [[Component:Data_Manager|data_manager.py]] || Data loading, timeframe aggregation | | 8 || [[Component:Data_Manager|data_manager.py]] | ||
|| Data loading, timeframe aggregation | |||
|| Harshad | |||
|- | |- | ||
| 9 || [[Component:Backtesting_Analytics|backtesting_analytics.py]] || Performance metrics, reporting | | 9 || [[Component:Backtesting_Analytics|backtesting_analytics.py]] | ||
|| Performance metrics, reporting | |||
|| Pawan | |||
|} | |} | ||
Latest revision as of 04:54, 8 January 2026
BacktestIQ – Strategy Simulation Platform Component Architecture
[edit]PART 1: Pipeline Architecture
[edit]Pre-aggregated OHLC data (5M, 15M, 1H, 4H, 1D) derived from 1-minute source. At present conversion doesnot happen at runtime, it is done beforehand. data_manager.py just loads pre-converted CSV files.
Raw OHLC Data (1D, 4H, 1H, 15M, 5M)
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ LAYER 1: multi_timeframe_analysis.py │
│ "Are all timeframes pointing the same direction?" │
│ │
│ • Analyzes [1D, 4H, 1H, 15M, 5M] via TrendAnalysisCore │
│ • Calculates weighted alignment score (hierarchical weights) │
│ • 15-minute confirmation requirement │
│ • Output: TimeframeAnalysisResult (aligned, direction, score) │
└─────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ LAYER 2: market_state_analysis.py │
│ "What kind of market are we in?" │
│ │
│ 7 Detection Algorithms: │
│ 1. Railroad Trend - Strong one-sided move (consistency > 80%) │
│ 2. Creeper Move - Slow grinding action (avg range < 0.5%) │
│ 3. Volatility Classification - High/Normal/Low │
│ 4. Market State - Trending/Range/Creeper/Momentum │
│ 5. Two-Day Trend - Both days close same direction │
│ 6. Trend Phase - EARLY/MIDDLE/LATE │
│ 7. Institutional Behavior - Fight, Accumulation, BOS │
│ Output: MarketStateResult │
└─────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ LAYER 3: setup_quality_detection.py │
│ "How good is this setup? Grade it A+ to F." │
│ │
│ 5-Factor Weighted Scoring: │
│ • Timeframe Alignment (30%) │
│ • Trend Strength (20%) │
│ • Entry Quality (15%) │
│ • Key Level Proximity (20%) [WIP JIRA] │
│ • Risk/Reward (15%) │
│ │
│ Output: SetupQualityResult (grade, score, position_size) │
└─────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ LAYER 4: signal_generation_trade_management.py │
│ "Should we trade? What direction? Where's entry/stop/target?" │
│ │
│ Direction Logic: │
│ • MA21 rising → LONG │
│ • MA21 declining → SHORT │
│ • Flat → MTF fallback [WIP market consolidation] │
│ │
│ Gate Filters: Hour, MA Direction, Probability Zone [WIP JIRA] │
│ Output: Signal (direction, entry, stop, target, grade) │
└─────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ LAYER 5: trade_execution_engine.py │
│ "Execute the trade, manage the position, calculate P&L" │
│ │
│ Execution: Slippage modeling, Commission (Rs 20/lot), CTT (0.01%) │
│ Position Management: Trailing stop, Breakeven stop, Time exit │
│ Output: Trade objects with complete P&L [WIP JIRA] │
└─────────────────────────────────────────────────────────────────────┘
PART 2: Component Index
[edit]| # | Component | Purpose | Owner |
|---|---|---|---|
| 1 | multi_timeframe_analysis.py | MTF alignment across 5 timeframes | Pawan |
| 2 | trend_analysis_core.py | Per-timeframe trend direction, MA slopes | Chayan |
| 3 | market_state_analysis.py | Railroad, creeper, volatility, trend phase | Vishal |
| 4 | setup_quality_detection.py | 5-factor scoring, A+ to F grades | Vishal |
| 5 | signal_generation_trade_management.py | Direction, filters, entry/stop/target | Chayan |
| 6 | trade_execution_engine.py | Execution, position management, P&L | Harshad |
| 7 | probability_zone_analysis.py | Probability zones, crash bar [Work in progress] | Rikk |
| 8 | data_manager.py | Data loading, timeframe aggregation | Harshad |
| 9 | backtesting_analytics.py | Performance metrics, reporting | Pawan |