← Back to home Workflow Guide

How the Plumbline Pipeline Works

An end-to-end walkthrough of the six-stage validation pipeline — from vague trading idea to a statistically-vetted, portfolio-fit strategy. Each stage has a specific job, a clear deliverable, and a hard pass/fail criterion before advancing.


Pipeline Overview

Six stages. One decision gate. Every strategy that reaches your portfolio has survived statistical scrutiny.

1
Stage I: Build
Define strategy requirements & generate a structured prompt.
Plumbline Suite
2
AI + NT8 Editor
Generate NinjaScript code and compile in NT8.
NinjaTrader 8 + AI
3
Strategy Analyzer
Backtest 8+ years and export the trade list as CSV.
NinjaTrader 8
4
Stage II: Backtest Verification
Statistical validation: expectancy, p-values, Monte Carlo, walk-forward.
Plumbline Suite
5
Decision Gate
Pass → Portfolio Fit  |  Fail → loop to Stage 1.
Pipeline Control
PASS ✓ Continue to Portfolio Fit
FAIL → Iterate back to Stage 1
6
Stage III: Portfolio Fit
Multi-strategy analysis: correlation, drawdown, allocation.
Plumbline Suite

Pipeline Philosophy

No strategy enters your portfolio without passing statistical validation first. The Decision Gate after Backtest Verification is the single most important checkpoint in this pipeline — it prevents curve-fit, fragile, or random strategies from contaminating your portfolio. Only validated, evidence-backed strategies proceed to multi-strategy analysis. Most strategies will not pass. That does not mean the software is broken. Most strategies simply do not have edge.


Stage Details — Stages 1 to 3

Specification, code generation, and backtesting.

1
Plumbline Stage I: Prompt Builder
Plumbline Trading Suite

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
AI Tool + NT8 NinjaScript Editor
NinjaTrader 8 + AI Tool

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 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
NT8 Strategy Analyzer
NinjaTrader 8 Platform

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).


Stage Details — Stages 4 to 6

Statistical validation, the decision gate, and portfolio analysis.

4
Plumbline Stage II: Backtest Verification
Plumbline Trading Suite

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 permutation tests, Monte Carlo simulation, and walk-forward analysis to stress-test the strategy.

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 t-test p-value (< 0.05 required).
  • Run Monte Carlo simulation — drawdown and probability of ruin.
  • Evaluate walk-forward / out-of-sample (OOS) performance.
Output

A comprehensive statistical validation report: pass or fail on 5 core tests.

5
Decision Gate
Pipeline Control

The Decision Gate is the most critical checkpoint in the pipeline. It sits between individual strategy validation and portfolio-level analysis. A strategy failing any of the five tests is rejected before it can enter your portfolio.

Key Actions
  • Review all 5 pass/fail results from Backtest Verification.
  • PASS: Strategy has real statistical edge → proceed to Portfolio Fit.
  • FAIL: Strategy does not survive validation → do NOT add to portfolio.
  • For failing strategies: use Prompt Builder diagnostic mode.
  • Generate a targeted debugging/refactoring prompt and restart at Stage 1.
  • Document lessons learned in an assumptions log for the next iteration.
Output

A clear pass/fail decision. Passing strategies advance. Failing strategies iterate.

6
Plumbline Stage III: Portfolio Fit
Plumbline Trading Suite

Portfolio Fit receives only validated, passing strategies. It combines them into a portfolio view and evaluates diversification by analyzing daily P&L correlation, portfolio-level drawdown, allocation weighting, and blended equity curves.

Key Actions
  • Import CSV files from multiple validated strategies only.
  • Set capital allocation and commission parameters.
  • Review the correlation matrix (daily P&L between strategies).
  • Analyze blended equity curve and portfolio drawdown.
  • Evaluate the diversification benefit score.
  • Run portfolio-level Monte Carlo simulation and export reports.
Output

Portfolio analysis: correlation, drawdown, allocation, diversification, blended performance.


Validation Gates & the Iteration Loop

The exact thresholds that decide whether a strategy advances, iterates, or is discarded.

Stage 4 — Backtest Verification Pass / Fail Criteria
Decision Gate requires ALL tests to pass
Validation TestPass ThresholdWhat It Measures
Positive Expectancy> $0 per tradeAverage profitability per trade.
Sign-Flip Permutation P-Value< 0.05Edge is not due to random win/loss order.
T-Test P-Value< 0.05Statistical significance of mean trade P&L.
Monte Carlo Prob. of Ruin< 5%Likelihood of account blowout under stress.
Walk-Forward OOS EdgePositive OOS profitStrategy holds up on unseen data periods.
Stage 6 — Portfolio Fit Evaluation Criteria
Only validated strategies reach this stage
Portfolio MetricPass ThresholdWhat It Measures
Portfolio Max Drawdown< 25% of capitalWorst peak-to-trough decline of combined equity.
Inter-Strategy Correlation< 0.40 averageStrategies should not move in lockstep.
Portfolio Expectancy> $0 per tradeBlended portfolio must be net profitable.
Allocation BalanceNo single strategy > 40%Avoid concentration risk in one system.
Diversification Benefit Score> 0Portfolio better than best single strategy risk-adjusted.

The Iteration Loop — Why the Gate Matters

The Decision Gate between Backtest Verification and Portfolio Fit 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 Stage 1. Each iteration produces a more robust candidate. The goal is a portfolio of independently validated, low-correlation strategies that survive every statistical test.


Quick Reference — Pipeline Cheat Sheet

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

#NameCategoryKey Action & Output
1Prompt BuilderPlumblineDefine requirements → generate structured NinjaScript prompt.
2AI + NT8 EditorNT8 + AI ToolPaste prompt → AI generates code → compile in NT8 editor.
3Strategy AnalyzerNinjaTrader 8Backtest 8+ years → Trades tab → Export CSV.
4Backtest VerificationPlumblineDrop CSV → check expectancy, p-values, Monte Carlo, WFA.
5Decision GatePipeline ControlPASS → Portfolio Fit  |  FAIL → loop to Stage 1.
6Portfolio FitPlumblineImport validated CSVs → correlation, drawdown, allocation.

Pipeline Principles

Validation-First: No strategy enters your portfolio without passing all five statistical tests.
Gate Before Portfolio: The Decision Gate prevents unvalidated strategies from contaminating portfolio analysis.
Anti-Curve-Fit: P-value tests and walk-forward analysis detect overfitting before it costs money.
Portfolio-Aware: Individual strategies are meaningless without portfolio-level correlation analysis.
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 Prompt Builder — Structured NinjaScript prompt generation.
Plumbline Backtest Verification — Single-strategy statistical validation.
Plumbline Portfolio Fit — Multi-strategy portfolio analysis.
NinjaTrader 8 Strategy Analyzer — Backtesting engine and CSV trade export.
NinjaTrader 8 NinjaScript Editor — Code compilation and strategy deployment.

Disclaimer

Read Before Trading

The Plumbline Trading Suite is provided for educational and informational purposes only. It does not constitute financial advice, trading recommendations, or guarantees of profitability. Past performance is not indicative of future results. Futures and derivatives trading involves substantial risk of loss and is not suitable for all investors. All trading decisions are the sole responsibility of the user. Your data is processed 100% locally in your browser — no information is sent to any server, API, or cloud service.