System Documentation & Architecture

Professional Backtesting Engine: How TradeXil Tests Trading Strategies Across 200+ Features and 5 Timeframes

Comprehensive technical documentation explaining TradeXil's backtesting infrastructure: strategy-based profile generation, weighted scoring methodology, multi-timeframe analysis, and production-grade simulation for algorithmic traders and quant developers.

Why Backtesting Matters—And Why Most Traders Get It Wrong

Backtesting is the foundation of algorithmic trading. It answers the critical question: "Does this strategy work on real data?" But traditional backtesting has massive limitations that affect results, accuracy, and real-world applicability.

  • Manual Testing is Impractical: Most traders test 10-50 strategies manually—a tiny sample from millions of possibilities
  • Limited Features: Calculating 200+ indicators is slow, expensive, and error-prone without proper infrastructure
  • Overfitting Risk: No systematic approach to separate robust strategies from statistical noise
  • Production Gap: Backtest strategies often fail when deployed to live trading due to unrealistic assumptions
  • Data Alignment Issues: Multi-timeframe testing suffers from lookahead bias without careful implementation

TradeXil solves this with professional-grade infrastructure: Pre-calculated 200+ features eliminate computation overhead, strategy-based profile generation increases pass rates 10x over random generation, weighted scoring ensures realistic probability estimates, and forward-fill architecture prevents lookahead bias in multi-timeframe testing.

This document explains how the system works. It's designed as technical documentation for algorithmic traders, quant developers, and data scientists using TradeXil infrastructure. This is not a tutorial or service offering—it's a deep dive into the methodology, architecture, and real results behind strategy evaluation.

System Architecture: Five-Phase Pipeline

The TradeXil backtesting engine follows a modular, production-grade pipeline optimized for speed, accuracy, and realistic trade simulation. Each phase is isolated and optimized independently, enabling parallel processing and iterative improvements.

1

Data Loading

Load 200+ pre-calculated features from TradeXil's historical datasets (5 years BTCEUR, 2020-2024) across 5 timeframes (5m, 15m, 1h, 4h, 1d). Parquet format enables 10x faster loading vs CSV.

2

Profile Generation

Automatically generate 10,000+ trading strategy profiles using strategy-based architecture (not random). Each profile: CORE features + optional + coherent strategy indicators. Pass rate: 5-12% (vs 0.5-1.7% with random generation).

3

Parallel Backtesting

Execute all profiles in parallel using 8 worker processes. Realistic trade simulation: one trade at a time, with selected spread costs and commission, fixed TP/SL logic - provides reliable results. Performance: 1,000 profiles in ~30 minutes for each machine core.

4

Filtering & Ranking

Apply custom filters (15+ trades, 30%+ win rate, 1.0+ profit factor, <40% drawdown) and weighted scoring to identify top-performing strategies. Calculate 18+ performance metrics per profile (Sharpe, Sortino, Calmar ratios, etc.).

5

Report Generation

Generate CSV, JSON, and summary reports with top 100 profiles ranked by weighted score. Each report includes: signal history, performance metrics, profile conditions, and backtesting parameters used.

Data Infrastructure

TradeXil's 200+ pre-calculated features across 23 categories eliminate computation overhead. Same features in historical datasets and live API enable seamless backtest-to-production deployment without code changes.

Profile Generator

Strategy-based generation (vs random) achieves 10x higher pass rates by incorporating market context and indicator coherence. Four strategy philosophies: Trend Following, Oscillator Mean Reversion, Band/Channel Trading, Structure/Breakout.

Backtest Engine

Realistic trade simulation: one trade at a time, spread costs, commission, fixed TP/SL, conservative intrabar. Forward-fill architecture prevents lookahead bias. Uses NumPy vectorization for speed.

Performance Analyzer

Calculate 18+ metrics (Sharpe, Sortino, Calmar, profit factor, drawdown, consecutive losses) and apply weighted ranking. Filters ensure statistical significance. Top 100 strategies ranked by balanced formula (50% return, 15% volume, 35% risk metrics).

Strategy-Based Profile Generation: The Core Differentiator (10x Higher Pass Rates)

Why coherent strategy architecture achieves 10x better results than random condition generation. This is the proprietary methodology that enables TradeXil's backtesting system to find robust, repeatable strategies at scale.

The Problem with Random Profile Generation

Simple AND Logic

Pass Rate: 0.5-1.7%

Randomly combine indicators without market context. No strategy coherence. Results in noise—most profiles are statistical flukes that don't repeat.

Example: Profile requires RSI < 30 AND MACD> 0 AND Volume > average AND Bollinger Band lower touch, regardless of whether these indicators align philosophically.

Strategy-Based Weighted Scoring

Pass Rate: 5-15%

Market context filtering + indicator coherence. Each strategy follows one philosophy. 10x more profiles pass realistic filters and produce repeatable results.

Example: "Oscillator Mean Reversion" profiles only use RSI, Stochastic, CCI (all oversold indicators). Coherent, focused, realistic.

Three-Layer Architecture: How Profiles Are Built (Example)

Layer 1: Core Categorical Features

Purpose: Market context filtering ensures strategies only trade when conditions align with the strategy philosophy. Prevents trading against the market regime.

Feature Purpose Example Values Role
MARKET_REGIME Overall market direction (sentiment) bullish, neutral, bearish Primary filter
TREND_REGIME Trend strength (momentum) strong_trending, weak_trending, ranging Strategy qualifier
VOLATILITY_REGIME Volatility state (environment) normal, high, low Risk modifier
MARKET_STRUCTURE Price structure (HH/HL/LL/LH) HH, HL, LL, LH Entry context

Why this matters: A LONG (bullish) strategy requires compatible market conditions. Incompatible regimes automatically filter out the strategy. This prevents trading against market structure.

Layer 2: Optional Categorical Features

Purpose: Add specificity without over-complexity. Increase selectivity to reduce false signals. Each optional condition adds 0.1 to score and increases threshold by 0.05.

Examples:

  • CANDLE_TYPE (bullish, doji, bearish)
  • LIQUIDITY_SCORE (high, medium, low)
  • MARKET_SUPPORT_ZONE (true, false)
  • IS_DOJI (true, false)
  • VOLUME_SURGE (true, false)
  • PRICE_AT_MA (above, below, touching)

Layer 3: Strategy Indicators

Purpose: Coherent indicator selection ensures all indicators follow the same market philosophy. Prevents mixing contradictory signals (e.g., trend + mean reversion in same profile).

Trend Following

Philosophy: Ride momentum shifts. Enter when trend accelerates.

Indicators: Trend-directional indicators (ADX, Supertrend, etc.)

Best for: Strong trending markets

Oscillator Mean Reversion

Philosophy: Buy oversold, sell overbought. Trade range extremes.

Indicators: Momentum oscillators (RSI, Stochastic, CCI, etc.)

Best for: Ranging/sideways markets

Band/Channel Trading

Philosophy: Bounce from dynamic support/resistance. Trade the bands.

Indicators: Envelope indicators (Bollinger Bands, Keltner, etc.)

Best for: Volatile sideways markets

Structure/Breakout

Philosophy: Trade momentum shifts and structure breaks.

Indicators: Volume and structure tools (Volume, VWAP, Pivots, etc.)

Best for: Breakout setups and momentum shifts

Why ONE philosophy only: Mixing Trend Following (exit on reversal) + Mean Reversion (sell overbought) creates conflicting signals. Strategy-based ensures coherence.

Weighted Scoring Methodology: Architecture Overview

SIGNAL EVALUATION PROCESS (Generalized)

Step 1: Market Context Check
├─ Verify market regime compatibility ✓
├─ Check trend alignment ✓
├─ Validate volatility conditions ✓
└─ Confirm price structure fit ✓

Step 2: Strategy Condition Evaluation
├─ Evaluate core criteria (required)
├─ Check optional confirmations (bonus)
└─ Verify indicator group alignment (strategy-specific)

Step 3: Scoring & Threshold Comparison
├─ Calculate weighted core score
├─ Add optional condition bonuses
├─ Apply strategy philosophy multiplier
├─ Compare against dynamic threshold

Step 4: Entry Decision
├─ Total Score ≥ Threshold? YES → Signal Valid ✅
└─ Total Score < Threshold? NO → Signal Rejected ❌

Key Principle: Coherent strategy (all indicators from same philosophy) +
market context alignment = realistic, repeatable signal detection

Key Design Principle: The scoring system combines flexible threshold matching with coherent strategy architecture. Market context acts as a primary filter, while weighted indicators provide secondary confirmation. This layered approach prevents noise and false signals while maintaining signal frequency for systematic trading.

Multi-Timeframe Analysis: Coming soon

Current v2.0 uses single-timeframe analysis. Multi-timeframe confirmation is planned for Q1 2026.

Multi-Timeframe Support: Current Status

Multi-timeframe confirmation was supported in v1.x (legacy). It was removed in v2.0 to focus on single-timeframe optimization and strategy architecture refinement. Multi-timeframe will return in the future with improved logic and tighter cross-timeframe alignment. Current backtesting results are based on single-timeframe signal detection.

How Multi-Timeframe Will Work

Single-Timeframe (Current v2.0)

Signal Frequency: ~3-5% of candles

Execution: Entry on first qualified signal

Optimized per-timeframe signal detection. All results shown are single-TF based.

Multi-Timeframe (Upcoming)

Signal Frequency: ~1-2% of candles

Execution: Entry on cross-timeframe alignment

Combines 5m + 30m + 1h (or 1h + 4h + 1d). Fewer, higher-confidence signals.

Forward-Fill Architecture: No Lookahead Bias

When multi-timeframe returns, the same forward-fill logic prevents lookahead bias:

Timeline Alignment (Multi-Timeframe):
5m candles:  10:00  10:05  10:10  10:15  10:20
1h candles:  [---- 10:00-11:00 ----]
4h candles:  [---- 08:00-12:00 ----]

Forward-filled values (no lookahead):
10:00 → 5m: active signal | 1h: active (10:00-11:00) | 4h: active (08:00-12:00)
10:05 → 5m: active signal | 1h: same (10:00-11:00) | 4h: same (08:00-12:00)

Only check alignment with CLOSED candles from higher TFs ✓

Realistic Trade Simulation: Conservative Exits

Professional-grade execution logic ensures backtest results match production trading.

ONE Trade at a Time

Realistic constraint: no overlapping positions. Prevents over-optimistic portfolio returns.

Entry Costs (0.02% Spread)

Entry executed at signal candle close + bid-ask spread. Accounts for real market costs.

Conservative Intrabar Exits

Both TP and SL checked within candle. If both touched, assume SL hit first (risk management priority).

Commission on Exit (0.1%)

Exit costs applied when position closes at TP or SL. Realistic fee structure.

Parallel Processing

Tests 1000 profiles in ~30 minutes on single core. Multiprocessing + NumPy vectorization for speed.

Fixed Conditions

Consistent conditions ensure reliable results and minimum degradation when deployed live.

18+ Performance Metrics & Intelligent Ranking

Comprehensive evaluation ensures strategies are robust, repeatable, and production-ready.

Profitability

Total return from all trades including commissions and spread costs. Measured through absolute P&L, profit factor (gross wins vs gross losses), and expectancy (average profit per trade).

Win/Loss Analysis

Percentage of profitable trades (win rate), average win vs average loss ratio, best and worst individual trades, and total trade count. Ensures statistical significance and consistent edge across multiple executions.

Risk Assessment

Maximum drawdown (peak-to-trough decline), consecutive losses streak, and average recovery time. Measures downside exposure and emotional resilience required to trade the strategy live.

Risk-Adjusted Returns

Sharpe ratio (return per volatility), Sortino ratio (return per downside volatility), and Calmar ratio (return per maximum drawdown). Reveals true risk-adjusted performance independent of absolute returns.

Weighted Ranking Formula

Strategies ranked by a balanced formula that prioritizes profitability, robustness, and risk management:

Total Return 50%
Trade Count 15%
Risk Metrics (Drawdown, Sharpe) 20%
Consistency & Win Rate 15%

Minimum Requirements (All Must Pass)

15+ Trades

Statistical significance

30%+ Win Rate

Baseline profitability

1.0+ Profit Factor

More wins than losses

<40% Max Drawdown

Risk control

Real Results & Statistics: The Proof

Actual backtesting performance on 5 years of BTCEUR data (2020-2024).

Test Configuration

  • Dataset: BTCEUR 2020-2024 (5 years)
  • Timeframes: 5m, 15m, 1h, 4h, 1d
  • Profiles Generated: 10,000+ per timeframe
  • Mode: Strategy-based weighted generation

Pass Rate Comparison

Method Generated Passed Rate
Random AND Logic 10,000 50-170 0.5-1.7%
Strategy-Based (Weighted) 10,000 500-1,500 5-15%

10x improvement with intelligent strategy architecture

Performance Distribution

Across 10,000+ profiles tested:

  • Peak Distribution: 15-25% annual return
  • Outliers (Top 5%): 100%+ annual return
  • Avg Sharpe Ratio: 1.5-2.0 (profitable range)
  • Avg Win Rate: 50-55% (realistic)

How TradeXil Data Powers This System

The 200+ pre-calculated features are the backbone of efficient, production-grade backtesting. This infrastructure enables the entire backtesting pipeline documented above.

10x Faster Loading

Most platforms: Calculate indicators on-the-fly (slow, error-prone, inconsistent)

TradeXil: Pre-calculated in historical datasets—instant access to 200+ features. No computation delays.

Seamless Backtest-to-Production

Historical: Download datasets with 200+ features

Live: Deploy to real-time API—same features, zero code changes, ~1s latency

Consistent Data Structure

Identical feature organization, calculation methods, and timeframes (5m, 15m, 1h, 4h, 1d) across historical and live systems. No translation layer needed.

23 Feature Categories

Moving Averages (12 variants), Momentum (RSI, Stochastic, MACD, CCI), Volatility (Bollinger, ATR), Volume (OBV, VWAP), Trend (ADX, Supertrend), Market Structure, Candle Analysis, and 8 advanced features for context.

Start Using This Infrastructure

Access the same 200+ features used in this backtesting system via historical datasets or live API.

Engine Version & Roadmap

Current system version, recent improvements, and planned features.

🔵 Current Version: v2.0

Released: November 2025

Status: Production

Latest Features (v2.0)

  • Strategy-Based Profile Generation: 10x higher pass rates vs random generation
  • Weighted Scoring System: Flexible threshold matching (not strict AND logic)
  • Single-Timeframe Analysis: Optimized per-timeframe signal detection on 5m, 15m, 30m, 1h, 4h, 1d
  • Parallel Backtesting: 8-worker multiprocessing, ~2 hours for 10,000 profiles
  • 18+ Performance Metrics: Sharpe, Sortino, Calmar, drawdown, win rate, profit factor
  • Conservative Exit Logic: Intrabar TP/SL detection, SL takes priority
  • Real-Time Data Integration: Same 200+ features in historical and live API

🟠 Upcoming Features (Q4 2025)

Feature: Strategy Fixes for 4H & 1D Timeframes

Timeline: Q1 2026

Current results show minimal profitable profiles on 4H and 1D timeframes. This update focuses on optimizing strategy parameters, entry conditions, and scoring thresholds specifically for longer timeframes to increase pass rates and profitability.

  • • Extended timeframe-specific tuning
  • • Higher timeframe momentum detection improvements
  • • Extended volatility regime filtering

Feature: Main Trading Session (Configurable)

Timeline: Q4 2025

Add a configuration option to run backtests either on all candles (24/7) or restricted to one or more main trading sessions (exchange-local trading hours). This option only affects when entries are allowed — TP/SL evaluation and intrabar exit logic remain unchanged, so exit realism is preserved.

Rationale: filtering out low-liquidity, off-hour noise improves signal quality for manual traders, reduces false-positives from thin-market volatility, and produces results closer to typical live-hours execution while keeping exit behavior consistent with production.

  • • Config toggle: `all_hours` vs `session_windows` (list of named session ranges, timezone-aware)
  • • Session presets: major market windows (e.g., European morning CET, US open ET)
  • • Entry-only filter: entries blocked outside sessions; TP/SL & intrabar checks still execute
  • • Reporting: backtest summary includes effective traded-hours and session impact metrics

Improvements: Faster Backtesting Results

Timeline: Q4 2025

Performance-focused upgrades to halve wall-clock time for large profile sets (especially low-TF backtests). The program will reduce Python overhead, improve parallelism, and limit I/O bottlenecks so high-volume tests complete faster and more predictably.

  • • CPU utilization: dynamic work-stealing and task sizing to avoid idle cores
  • • Multiprocessing improvements: batched workloads, reduced IPC overhead, per-symbol partitioning
  • • Algorithmic optimizations: vectorized condition checks, early-exit heuristics, cached indicators
  • • I/O & memory: memory-mapped Parquet reads, smaller working sets, and GC pressure reduction
  • • Checkpointing & resume: incremental result saves to resume long runs without full re-run
  • • Observability: lightweight per-worker profiling, progress metrics, and a bottleneck dashboard

Feature: Multi-Timeframe Confirmation

Timeline: Q1 2026

Current v2.0 uses single-timeframe analysis exclusively. Multi-timeframe confirmation will combine 2-3 timeframes for stronger entry signals. Profiles will check alignment across 5m → 15m → 1h or 1h → 4h → 1d for higher-confidence trades.

  • • Cross-timeframe signal confirmation
  • • Aligned entry validation across TF hierarchy
  • • Improved win rates through confirmation logic

Note: This documentation reflects v2.0 capabilities (current production). Features marked as "Upcoming" are planned enhancements. All features are subject to technical validation and performance testing before release.

View Version History

Understanding This System: Next Steps for Algorithmic Traders

This page documents how TradeXil's backtesting infrastructure works. To use it in practice, explore the resources below.

1

Explore Datasets

Download TradeXil's free BTCEUR 1-day dataset (2020-2024) with all 200+ features. Parquet format, optimized for analysis.

→ Download Now
2

Review Feature Documentation

Understand all 200+ features: what they measure, how they're calculated, and their trading applications. 23 categories covered.

→ View Features
3

Access Real-Time API

Deploy strategies to production using TradeXil's real-time API. Same 200+ features, ~1s latency, full technical documentation.

→ API Documentation

About This Documentation: This page explains how the backtesting system works—architecture, methodology, and real performance data. It's designed for:

  • Algorithmic traders building trading systems
  • Quant developers integrating TradeXil data
  • Data scientists analyzing market patterns

This is not a service offering or tutorial—it's technical documentation of the system architecture used by TradeXil infrastructure.

Backtesting Engine: Access & Current Status

Current Availability: The backtesting engine is currently available for custom analysis requests only. This means you cannot access it as a public service or self-service tool. To use it, contact TradeXil to discuss your specific backtesting requirements.

What You CAN Use Today: TradeXil offers a live paper trading bot (real-time trading signals) powered by the same 200+ features documented here. Monitor live signal execution without backtesting engine access.

Future Plans: Public backtesting engine access is uncertain and not currently planned. Focus remains on the live trading infrastructure. For custom backtesting needs, reach out via the contact form.

Technical FAQ: Deep Dive Questions

Common technical questions about the backtesting system architecture, methodology, and capabilities.

How many strategies can be tested per day?

On a single core: ~25000 profiles per day, depending on timeframes and data size. The higher the core count, the higher the throughput. v2.0 uses NumPy vectorization + multiprocessing for optimal throughput.

Does backtesting work with other cryptocurrencies beyond BTCEUR?

The engine is asset-agnostic: It works with ANY asset that provides OHLCV data (open, high, low, close, volume). The backtesting logic is universal—crypto, stocks, forex, commodities. Currently, TradeXil provides BTC/EUR, ETH/EUR datasets (2020-2024). The engine will support XRP/EUR, PAXG/USD datasets later, but any asset with 200+ pre-calculated features can be backtested.

Can I use my own data or import external datasets?

Yes, the system supports custom data sources. Your data must include 200+ pre-calculated features (or the engine can calculate them). Parquet format is optimal for performance. Contact us for custom data integration assistance.

What makes strategy-based profiles 10x better than random generation?

Three factors: (1) Market context filtering—strategies only trade aligned market regimes, (2) Indicator coherence—all indicators follow one philosophy (trend, mean reversion, bands, breakout), (3) Flexible scoring—80% indicator match passes with bonus scoring (vs strict AND requiring 100%). Result: 5-15% pass rate vs 0.5-1.7%.

How does forward-fill prevent lookahead bias in multi-timeframe testing?

Higher timeframes use only closed candle data aligned to the lower timeframe timing. At 10:00 (1h), the 4h candle from 08:00 is used (already closed). At 13:00 (1h), still the 08:00→12:00 candle (no forward lookahead). Only when the 4h candle closes do we use the new data. This prevents using future price information.

What's the minimum dataset size needed for statistical validity?

2 years minimum (trades varies per timeframe). 5 years recommended (TradeXil standard, 2020-2024) for robust signal-to-noise ratio and market cycle coverage. Longer datasets reduce overfitting risk.

Can backtested strategies be deployed to live trading?

Yes, seamlessly. Backtest on historical datasets, deploy with the real-time API. Same 200+ features = zero code changes. The engine includes live paper trading mode for safe validation before risking real capital.

How are TP/SL levels calculated and adjusted?

TP and SL are set at entry from profile parameters (e.g., tp_multiplier = 1.007, sl_multiplier = 0.998). They never move after entry (no trailing stops, no manual adjustment). Exits checked intrabar; if both TP and SL touched in same candle, SL is assumed to hit first (risk management priority).

What happens when a strategy generates multiple signals per candle?

The system enforces "one trade at a time" constraint. New signals are logged but not executed if a position is open. Prevents unrealistic multi-leg portfolios and maintains realistic trading. Useful for validating signal consistency across conditions.

How accurate is backtesting compared to live trading?

Conservative assumptions increase accuracy: 0.02% spread (realistic bid-ask), 0.1% commission (realistic exchange fees), conservative intrabar TP/SL detection (SL priority), one-trade-at-a-time constraint. However, slippage, order rejection, and market impact remain variables in live execution. Backtest results are upper-bound estimates.

Can I customize the scoring weights or strategy generation parameters?

Yes, fully. The engine is built for complete customization: scoring weights, entry/exit thresholds, TP/SL multipliers, profile generation logic, fees, spread, entrance conditions—everything is configurable. v2.0 uses fixed default parameters for reproducibility and documentation clarity, but the underlying engine supports full parameter customization for research and strategy development.

How does the system handle market gaps or missing candles?

TradeXil datasets have zero gaps: Every single date in the 2020-2024 BTCEUR dataset is filled with continuous OHLCV data (crypto markets trade 24/7). The engine validates continuity and detects edge cases. If gaps exist in external datasets, the system either (1) uses forward-fill to carry forward last known value, or (2) skips the gap period. No signals are triggered during gaps or market discontinuities.

Start Building Systematic Trading Strategies Today

Access professional backtesting infrastructure with 200+ pre-calculated features, multi-timeframe analysis, and production-grade simulation.