← Back to home Workflow Guide

How the Plumbline Pipeline Works

An end-to-end walkthrough of the six-Step validation pipeline — from vague trading idea to a statistically-vetted, portfolio-fit, prop-firm-ready strategy. Four of the six Steps run inside the Plumbline Trading Suite (its four software Stages, I–IV); the other two run inside NinjaTrader 8.


Pipeline Overview

Six Steps. One Decision Gate. Four Plumbline software Stages. Every strategy that reaches your portfolio has survived statistical scrutiny.

Master mapping — Steps ↔ Software ↔ Plumbline Stages
Step Name Software Plumbline Stage
1Build (Prompt Builder)Plumbline Trading SuiteStage I
2Compile strategy codeNinjaTrader 8 (NinjaScript Editor)
3Backtest strategyNinjaTrader 8 (Strategy Analyzer)
4Backtest VerificationPlumbline Trading SuiteStage II
5Portfolio FitPlumbline Trading SuiteStage III
6Prop Firm VerificationPlumbline Trading SuiteStage IV

Vocabulary: Steps (1–6) describe the workflow you follow. Stages (I–IV) describe the four Plumbline software modules that run inside four of those Steps. The Decision Gate between Step 4 and Step 5 is not a Step — it is the logical checkpoint you apply based on Stage II's pass/fail verdict.

Plumbline six-Step pipeline flow diagram with Decision Gate branching 1 Step 1 · Plumbline Stage I Build — Prompt Builder Define requirements & generate structured NinjaScript prompt. 2 Step 2 · NinjaTrader 8 Compile Strategy Code NinjaScript Editor — paste, compile, resolve errors. 3 Step 3 · NinjaTrader 8 Backtest Strategy Strategy Analyzer — 8+ years, export trades as CSV. 4 Step 4 · Plumbline Stage II Backtest Verification 5 statistical tests — expectancy, sign-flip, t-test, MC, WFA. DECISION GATE All 5 Stage II tests pass? (not software — user checkpoint) FAIL ✗ Iterate back to Step 1 PASS ✓ 5 Step 5 · Plumbline Stage III Portfolio Fit Correlation, SPY regime alpha, benchmark vs. buy-and-hold. 6 Step 6 · Plumbline Stage IV · Planned Prop Firm Verification Rule-based sim: daily loss, trailing DD, consistency, P(pass). DEPLOY TO SIM minimum 30 trading days Legend Sequential pipeline flow PASS — advance FAIL — iterate back to Step 1 Plumbline software Stage NinjaTrader 8 Planned (not yet shipped)
The Decision Gate (yellow diamond) is a user checkpoint, not software. It routes on Stage II's pass/fail verdict.

Pipeline Philosophy

No strategy enters your portfolio without passing statistical validation first. The Decision Gate after Step 4 (Backtest Verification) is the single most important checkpoint in this pipeline — it prevents curve-fit, fragile, or random strategies from contaminating your portfolio and, later, your funded account. Only validated, evidence-backed strategies proceed to Step 5 (Portfolio Fit) and Step 6 (Prop Firm Verification). Most strategies will not pass. That does not mean the software is broken. Most strategies simply do not have edge.


Step Details — Steps 1 to 3

Specification, code compilation, and backtesting.

1
Step 1 — Build (Plumbline Stage I: Prompt Builder)
Plumbline Trading Suite · Stage I

The Prompt Builder enforces NinjaScript development discipline by generating structured, scope-locked prompts for AI coding tools. Each prompt includes workflow presets, core rules, scale profile, domain modules, and explicit deliverables.

Key Actions
  • Select workflow preset (Strategy, Indicator, Prop Firm, Multi-Timeframe).
  • Choose core rules (no API hallucination, scope lock, checkpoints).
  • Define scale profile and select domain modules.
  • Describe strategy logic or problem in plain English.
  • Generate a structured prompt or diagnostic prompt.
Output

A complete, structured NinjaScript development prompt ready for AI tool input.

2
Step 2 — Compile Strategy Code
NinjaTrader 8 · NinjaScript Editor

The AI tool receives the structured prompt and generates NinjaScript (C#) code. Paste it into the NT8 NinjaScript Editor, compile, and resolve errors. The structured prompt from Step 1 dramatically reduces compile failures, hallucinated methods, and scope drift.

Key Actions
  • Paste the structured prompt into your AI tool (Claude, ChatGPT, or Codex).
  • Review generated NinjaScript code for logic and correctness.
  • Open NinjaTrader 8 → NinjaScript Editor.
  • Paste code, compile, and fix any compilation errors.
  • Verify the strategy appears in the Strategies list.
Output

A compiled, error-free NinjaScript strategy loaded in NinjaTrader 8.

3
Step 3 — Backtest Strategy
NinjaTrader 8 · Strategy Analyzer

NinjaTrader's built-in Strategy Analyzer runs the compiled strategy against historical market data. Use a minimum of 8 years of data to capture multiple market regimes. After the backtest completes, export the trade list as a CSV file for external validation.

Key Actions
  • Open Strategy Analyzer → select strategy and instrument.
  • Set date range (minimum 8 years recommended).
  • Configure commission template, slippage, and fill type.
  • Run backtest and review initial Summary metrics.
  • Go to Trades tab → right-click → Export Trades → save as CSV.
Output

A CSV file containing all trade data (entry/exit times, profit, MAE, MFE, instrument).


Step Details — Steps 4 to 6

Statistical validation, portfolio analysis, and prop-firm rule simulation.

4
Step 4 — Backtest Verification (Plumbline Stage II)
Plumbline Trading Suite · Stage II

Backtest Verification performs rigorous statistical analysis on exported trade data to determine whether a strategy's edge is real or the result of randomness and curve-fitting. It applies five independent tests — positive expectancy, sign-flip permutation, one-sample t-test, Monte Carlo bootstrap, and anchored walk-forward analysis. Full statistical procedure, assumptions, and worked examples live on the Methodology page.

Key Actions
  • Drag and drop the NT8 CSV file into the validator.
  • Review positive expectancy (average profitability per trade).
  • Check sign-flip permutation p-value (< 0.05 required).
  • Check one-sample t-test p-value (< 0.05 required).
  • Run Monte Carlo bootstrap — drawdown distribution and probability of ruin.
  • Evaluate anchored walk-forward: median efficiency ≥ 0.50 and OOS profitability ≥ 60%.
Output

A comprehensive statistical validation report with pass/fail on all 5 tests.

Decision Gate · between Step 4 and Step 5

Apply the Stage II verdict.

The Decision Gate is not software and not a numbered Step. It is the logical checkpoint you apply after Step 4 based on Stage II's verdict — the single most important architectural decision in this pipeline. A strategy failing any of the five tests is rejected before it can enter your portfolio.

PASS ✓ All 5 Stage II tests cleared → import the validated CSV into Step 5 (Portfolio Fit / Stage III).
FAIL ✗ One or more Stage II tests failed → use the Prompt Builder's diagnostic mode to generate a targeted debugging prompt, then iterate back to Step 1.

For diagnosis: low expectancy points to weak entry/exit logic; a high p-value means the edge may be random noise; high ruin probability indicates inadequate risk management; a failed walk-forward signals overfitting to in-sample data.

5
Step 5 — Portfolio Fit (Plumbline Stage III)
Plumbline Trading Suite · Stage III

Portfolio Fit receives only validated, Stage II-passing strategies. It combines them into a portfolio view and evaluates three portfolio-context tests: cross-strategy correlation (Test 6), SPY regime alpha (Test 7), and portfolio vs. SPY buy-and-hold benchmark (Test 8). Stage III does not re-validate individual strategies; it assumes each has already passed Stage II. Full statistical procedure lives on the Methodology page.

Key Actions
  • Import CSV files from multiple Stage II-validated strategies only.
  • Set capital allocation and commission parameters.
  • Review the Pearson correlation matrix (daily P&L between strategies).
  • Read Regime Alpha across Direction, Volatility, and Trendiness buckets.
  • Evaluate the 9-metric SPY benchmark panel (alpha, beta, up/down capture, Sharpe, TIM).
  • Interpret the five-tier verdict on Test 8 (Real edge confirmed → SPY beat portfolio).
Output

Portfolio analysis: correlation matrix, regime breakdown, SPY benchmark comparison, and a plain-English verdict on whether the active portfolio adds risk-adjusted value over passive SPY.

6
Step 6 — Prop Firm Verification (Plumbline Stage IV) Planned
Plumbline Trading Suite · Stage IV · Under active development

Prop Firm Verification simulates a firm's evaluation rulebook against your strategy's historical trade log — daily loss limits, trailing drawdown, maximum static drawdown, minimum profit target, and consistency requirements. A strategy with a perfect Stage II report can still fail evaluation on a single unlucky Wednesday; Stage IV surfaces that risk before you fund an account. Full intended methodology lives on the Methodology page.

Key Actions
  • Load a firm's ruleset from a structured JSON template (Topstep, Apex, Lucid at launch).
  • Import a Stage III-validated strategy's trade log.
  • Run the deterministic pass: replay the trade log against the ruleset, record terminal state.
  • Run the Monte Carlo variation: bootstrap-resample the trade sequence, re-run the ruleset simulation.
  • Review P(pass), P(fail by daily loss), P(fail by total drawdown), P(fail by consistency rule).
  • Compare expected days-to-pass across candidate firms and rulesets.
Output

A prop-firm-specific report: pass probability, failure-mode breakdown by rule, expected days-to-pass conditional on passing, and a compatibility verdict per firm on your candidate list.


Validation Gates & the Decision Gate

The exact thresholds that decide whether a strategy advances, iterates, or is discarded. The Decision Gate is not software and not a numbered Step. It is the logical checkpoint you apply after Step 4 based on Stage II's verdict.

Step 4 (Stage II) — Backtest Verification Pass / Fail Criteria
Decision Gate requires ALL five tests to pass
Validation TestPass ThresholdWhat It Measures
Positive Expectancy> $0 per tradeAverage profitability per trade (Curtis Faith formulation).
Sign-Flip Permutation p-value< 0.05Edge is not due to random win/loss sign structure.
One-Sample t-Test p-value (one-tailed)< 0.05Statistical significance of mean per-trade P&L.
Monte Carlo P(ruin)< 5%Likelihood of hitting the drawdown threshold under bootstrap resampling.
Anchored Walk-Forwardmedian efficiency ≥ 0.50 and ≥ 60% OOS windows profitableEdge persists on unseen data across expanding folds.
Step 5 (Stage III) — Portfolio Fit Evaluation Criteria
Only Stage II-validated strategies reach this stage · Stage III emits verdicts, not hard gates
Portfolio MetricReadingWhat It Measures
Cross-strategy Pearson ρ|ρ| < 0.33 preferredDiversification benefit vs. redundant exposure.
Regime Alpha coverageProfitable in ≥ 66% of active buckets = Strong edgeWhether edge is regime-agnostic or regime-conditional.
Annualized alpha vs. SPY (OLS)> +2% AND portfolio Sharpe > SPY Sharpe = Real edgeRisk-adjusted outperformance vs. passive buy-and-hold.
Beta vs. SPY|β| < 0.3 market-neutral; 0.3–1.3 market-like; > 1.3 leveragedMarket exposure profile of the aggregate portfolio.
Up / Down CaptureIdeal: up high, down low or negativeAsymmetric participation in SPY rallies vs. drawdowns.
Step 6 (Stage IV) — Prop Firm Verification Criteria Planned
Rulebook-specific — thresholds vary by firm and account type
Simulated MetricPass Threshold (target)What It Measures
P(pass) — Monte Carlo> threshold (firm/user-defined)Fraction of resampled paths reaching the profit target without rule violation.
P(fail by daily loss)Report onlyFraction of paths violating the firm's max daily loss.
P(fail by total drawdown)Report onlyFraction of paths violating static or trailing max drawdown.
P(fail by consistency rule)Report onlyFraction of paths violating "no single day exceeds X% of profit"-style rules.
Expected days-to-passReport only (conditional on passing)Typical time from account start to profit-target hit.

The Iteration Loop — Why the Decision Gate Matters

The Decision Gate between Step 4 (Stage II) and Step 5 (Stage III) is the single most important architectural decision in this pipeline. A strategy that fails statistical validation has no business in your portfolio — adding it would contaminate correlation analysis, inflate the combined equity curve with unreliable returns, and mask real risk.

When a strategy fails, the specific failure tells you what to fix: low expectancy points to weak entry/exit logic; a high p-value means the edge may be random noise; high ruin probability indicates inadequate risk management; a failed walk-forward signals overfitting to in-sample data. Use the Prompt Builder's diagnostic mode to generate a targeted debugging prompt, then restart at Step 1. Each iteration produces a more robust candidate. The goal is a portfolio of independently validated, low-correlation strategies that survive every statistical test — and, at Step 6, a specific prop firm's rulebook.


Quick Reference — Pipeline Cheat Sheet

One-line summary of every Step. Print this, tape it to your monitor.

StepNameSoftware (Stage)Key Action & Output
1Build — Prompt BuilderPlumbline (Stage I)Define requirements → generate structured NinjaScript prompt.
2Compile Strategy CodeNinjaTrader 8Paste prompt → AI generates code → compile in NT8 editor.
3Backtest StrategyNinjaTrader 8Backtest 8+ years → Trades tab → Export CSV.
4Backtest VerificationPlumbline (Stage II)Drop CSV → check expectancy, p-values, Monte Carlo, WFA.
5Portfolio FitPlumbline (Stage III)Import validated CSVs → correlation, regime alpha, SPY benchmark.
6Prop Firm Verification PlannedPlumbline (Stage IV)Load ruleset → deterministic pass + Monte Carlo → P(pass), failure modes.
Between Step 4 and Step 5, a Decision Gate applies: a PASS on all five Stage II tests advances the strategy to Step 5. A FAIL routes back to Step 1 for iteration. The Decision Gate is not software — it is a logical checkpoint you apply based on Stage II's verdict.

Pipeline Principles

Validation-First: No strategy enters your portfolio without passing all five Stage II tests.
Decision Gate Discipline: The Decision Gate between Steps 4 and 5 prevents unvalidated strategies from contaminating portfolio analysis.
Anti-Curve-Fit: P-value tests and anchored walk-forward analysis detect overfitting before it costs money.
Portfolio-Aware: Individual strategies are meaningless without portfolio-level correlation, regime, and benchmark analysis.
Rulebook-Aware: Stage IV surfaces prop-firm-specific failure modes that Stages II–III cannot see.
Local-First: All data stays on your machine. No servers, cloud, or API calls.
Iterative: Failure is feedback. Each loop produces a stronger strategy.

Your Toolkit

Plumbline Stage I — Prompt Builder Structured NinjaScript prompt generation.
Plumbline Stage II — Backtest Verification Single-strategy statistical validation.
Plumbline Stage III — Portfolio Fit Multi-strategy portfolio and SPY-benchmark analysis.
Plumbline Stage IV — Prop Firm Verification Rule-based prop-firm simulation. Planned.
NinjaTrader 8 Strategy Analyzer Backtesting engine and CSV trade export (Step 3).
NinjaTrader 8 NinjaScript Editor Code compilation and strategy deployment (Step 2).