Skip to content

Repository files navigation

Strategy Validator

A runnable portfolio edition of a quantitative MNQ strategy-validation framework with realistic execution, temporal validation, testing, and synthetic demo data.

This project demonstrates how I design research software that can say no to a fragile trading hypothesis. It is intentionally not a live-trading system and it does not publish the private research edge.

The problem

Backtests can look precise while hiding look-ahead, contract mixing, unrealistic fills, missing costs, or an overfit parameter choice. Strategy Validator makes those assumptions explicit and executable in a small, reviewable Python package.

What I built

  • Typed individual-contract resolution with explicit rollover windows.
  • Session labeling in America/Chicago, including DST and trading dates.
  • Causal 1-minute to 5-minute OHLCV resampling.
  • Generic EMA, RSI, ATR, VWAP, prior-level, and opening-range features.
  • Long/short bracket execution with tick chronology, conservative bar fallback, commissions, slippage, MAE, and MFE.
  • Transparent aggregate metrics including expectancy, Profit Factor, drawdown, recovery, and streaks.
  • An educational Opening Range Breakout benchmark over deterministic synthetic data.
  • Representative tests, Ruff checks, GitHub Actions, and a clean installable package.

Architecture

flowchart LR
    A[Deterministic synthetic data] --> B[ContractResolver]
    B --> C[SessionEngine]
    C --> D[BarEngine]
    D --> E[FeatureEngine]
    E --> F[Educational ORB]
    F --> G[ExecutionSimulator]
    G --> H[MetricsEngine]
    H --> I[JSON and SVG report]
    J[Validation guards] -.-> D
    J -.-> G
    J -.-> H
Loading

Quick start

python -m pip install -e ".[dev]"
ruff check .
pytest -q
python examples/run_demo.py

The demo creates small synthetic CSVs, aggregate metrics, and SVG equity/drawdown artifacts under reports/public_demo/. The output is labeled SYNTHETIC - NOT REAL MARKET DATA and is not evidence of profitability.

Technology

Python 3.11+ | pandas | numpy | pytest | Ruff | GitHub Actions | NinjaTrader 8 diagnostics

Validation principles

  • Development and validation data must be chronologically separated.
  • As-of joins use at_or_before; future observations are never selected.
  • Ambiguous stop/target ordering uses ticks when available and a conservative stop-first fallback otherwise.
  • Commissions and slippage are visible in net PnL.
  • Results are not promoted because one sample is profitable.
  • The private research conclusion was that no tested strategy qualified for Final OOS under the full protocol.

Portfolio edition

This public repository contains a representative, runnable subset of the research framework. Licensed market data, proprietary strategy rules, commercial parameters, private experiment artifacts, and live-trading components are intentionally excluded.

The educational ORB is deliberately transparent and is not an approved or recommended trading strategy. Level II/DOM remains an optional future enhancement; no depth is inferred from Bid/Ask and no trading connector is included.

Repository map

src/strategy_validator/  Generic package modules
tests/                   29 representative public tests
examples/                Deterministic synthetic fixtures and demo
docs/                    Architecture, methodology, limits, and boundaries
reports/public_demo/     Sanitized aggregate demo artifacts
configs/                 Relative public demo and validation policies
ninjatrader/diagnostics/ Read-only experimental diagnostics, not CI compiled

Research result

The private laboratory found that the engineering framework could run its validation gates, while the tested strategy families did not produce a candidate robust enough to promote. Rejecting a weak benchmark is part of the result. See the public demo report for the intentionally synthetic example and the methodology for the research controls.

Safety and limitations

  • No broker connection, account, order, position, or live-trading code is included.
  • No real market data, NinjaTrader database, replay file, or personal path is required.
  • NinjaTrader C# files are experimental diagnostics and require NinjaTrader 8 on Windows; they are not compiled by CI.
  • Synthetic output cannot establish an edge or predict future performance.
  • This project is for portfolio review and educational inspection, not financial advice.

Read what is public versus private, limitations, and the portfolio overview.

About

Runnable portfolio edition of a quantitative MNQ strategy-validation framework with realistic execution, temporal validation, testing, and synthetic demo data.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages