0% found this document useful (0 votes)
10 views12 pages

Understanding Backtest Biases and Risks

The document discusses the pitfalls of backtesting in trading, highlighting biases such as look-ahead and survivorship bias, which can lead to inflated performance estimates. It emphasizes the importance of rigorous validation methods like walk-forward analysis to ensure strategies are robust across different market regimes and not merely overfitted to historical data. Additionally, it warns against ignoring execution realism and stresses the need for comprehensive metric selection beyond simple profit and loss to assess a strategy's true effectiveness.

Uploaded by

mohamadsodik505
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views12 pages

Understanding Backtest Biases and Risks

The document discusses the pitfalls of backtesting in trading, highlighting biases such as look-ahead and survivorship bias, which can lead to inflated performance estimates. It emphasizes the importance of rigorous validation methods like walk-forward analysis to ensure strategies are robust across different market regimes and not merely overfitted to historical data. Additionally, it warns against ignoring execution realism and stresses the need for comprehensive metric selection beyond simple profit and loss to assess a strategy's true effectiveness.

Uploaded by

mohamadsodik505
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

[BOX 1] WHY MOST BACKTESTS LIE

================================================================
A backtest is a simulation that reconstructs a decision process against historical
data. Its integrity is systematically compromised by unavoidable assumptions and
biases. A backtest that has not been aggressively corrected for these biases will
produce an inflated, unrealistic estimate of future performance, leading to
inevitable live failure.

Structural Biases Leading to Overestimation:

1. Look-Ahead Bias: The model, during backtest execution, has access to information
that would not have been available in real-time at the point of decision. This
includes using the closing price of a bar to generate a signal on that same bar, or
using future data to calculate indicators (e.g., using the entire dataset to
normalize). Even subtle forms (e.g., calculating volatility using a centered moving
average) create bias.
2. Survivorship Bias: The dataset contains only instruments that survived to the
present day. Failed companies, delisted stocks, or currency pairs that ceased
trading are excluded. This removes the severe losses that would have occurred from
holding those assets, biasing returns upward. For Forex, this is less common but
exists in cross-pairs or exotic pairs.
3. Cost Ignorance: Assuming execution at the modeled price (often the close) with
zero spread, commission, or slippage. This is the most common and damaging lie.
4. Liquidity & Market Impact Assumption: Assuming infinite liquidity at the
historical price. In reality, a large order would have moved the market, especially
in less liquid instruments or volatile periods. The backtest executes as a "price
taker" with no impact.
5. Data Snooping Bias: Repeatedly testing ideas on the same dataset until a
profitable combination is found. This is a form of multiple hypothesis testing
where the probability of finding a spurious correlation by chance approaches 1.

Historical Fit vs. Future Validity:


A backtest measures how well a strategy fits past data. Future validity measures
how well the strategy's underlying logic captures a persistent, repeatable market
dynamic. A high historical fit with low future validity indicates overfitting to
noise or to a unique, non-repeating market regime.

Backtests Reward Complexity:


Adding more parameters, rules, or conditions to a model increases its degrees of
freedom, allowing it to more closely fit the idiosyncrasies of the historical
sample. This improves in-sample performance metrics (higher Sharpe, smoother equity
curve) but almost always degrades out-of-sample and live performance. The backtest
environment inherently favors the complex model that can memorize the past over the
simple model that captures a general truth.

Reality Gap:
The measurable divergence between simulated (backtest/forward test) performance and
actual live trading performance. The reality gap is always positive from the
perspective of the simulation (live performance is worse). The goal of validation
is not to eliminate the gap—that's impossible—but to quantify it, minimize it, and
ensure it does not lead to system extinction.

Research Bias vs. Execution Bias:

· Research Bias: Errors introduced in the strategy design and backtesting phase
(look-ahead, overfitting, cost ignorance). This creates an optimistic model.
· Execution Bias: Errors introduced in the live trading environment (latency,
slippage, partial fills, broker errors, psychological interference). This worsens
the realized performance relative to the already-optimistic model.
Validation must attack research bias; robustness engineering must mitigate
execution bias.

Survivorship Illusion in Strategy Development:


The researcher only sees the strategies that passed the backtest filter. The
thousands of discarded, unprofitable ideas are not considered. This creates an
illusion that finding a profitable strategy is easier than it is and inflates the
perceived significance of the surviving strategy's metrics. This is analogous to
publishing only positive scientific results.

================================================================

[BOX 2] DATA SPLITTING & TEMPORAL INTEGRITY


================================================================
The chronological order of market data is a first-class property. Violating this
order destroys the structure of dependence, regime persistence, and information
flow, rendering any validation meaningless.

In-Sample (IS) vs. Out-of-Sample (OOS):

· In-Sample Data: The dataset used to develop, optimize, and train the strategy
(e.g., choose parameters, select features). This is the "research" dataset.
· Out-of-Sample Data: A completely unseen dataset, held back from the research
process, used to evaluate the strategy's performance. This is the first true test.
· Cardinal Rule: OOS data must never influence any aspect of the IS research
process. This includes parameter selection, feature engineering, regime definition,
and even the decision of which strategy to pursue. Any leakage invalidates the OOS
results.

Walk-Forward Analysis (WFA):


The only rigorous method for strategy validation in non-stationary time series. It
simulates the real-world process of periodically recalibrating a model on recent
data and then trading on future data.

· Process:
1. Define an IS period (e.g., 2 years).
2. Optimize/train the strategy on this IS period.
3. Define an immediately following OOS period (e.g., 6 months). Freeze all
strategy parameters.
4. Run the frozen strategy on the OOS period and record performance.
5. Slide the window forward: The next IS period now includes some of the previous
data (e.g., drop the first 6 months, add the last 6 months of OOS). Repeat
optimization and OOS testing.
· Output: A series of OOS performance "blocks." The aggregate statistics of these
blocks (mean return, Sharpe, max drawdown) provide a realistic estimate of live
performance under a regime of periodic re-optimization.
· Advantage: Respects temporal order. Tests adaptability to changing conditions.
Provides multiple, independent OOS datapoints.

Rolling Windows vs. Expanding Windows:

· Rolling Window: For each step in WFA, the IS period is a fixed-length segment of
the most recent past. (e.g., always 2 years of data). This adapts quickly to new
regimes but discards older, potentially useful data.
· Expanding Window: The IS period starts at a fixed point in the past and expands
to include all data up to the present. (e.g., start with 2 years, then 2.5, then
3...). This retains more history but may dilute the model's responsiveness to
recent regime shifts.
· Choice: Depends on the strategy's assumed edge decay rate. A high-frequency mean-
reversion strategy may need a rolling window (microstructure changes). A long-term
trend-following strategy may use an expanding window.

Why Random Shuffling Invalidates Logic:


Shuffling data (e.g., for k-fold cross-validation) destroys the temporal
dependencies that are fundamental to finance: volatility clustering, autoregressive
properties, regime persistence, and the causal flow of information. A strategy that
appears robust on shuffled data will fail in live trading because it was tested in
an environment that does not exist.

How Regime Changes Break Naive Validation:


A naive single train/test split (e.g., 70/30 split by data points) assumes the data
is identically distributed. If a major regime change (e.g., transition from low to
high interest rates) occurs in the middle of the dataset, the training set may be
from one regime and the test set from another. The strategy, optimized for regime
A, will fail in regime B, giving a false negative. Conversely, if the split happens
to place similar regimes in both sets, it gives a false positive. WFA inherently
exposes the strategy to multiple regimes across its OOS blocks, providing a more
accurate stress test.

================================================================

[BOX 3] OVERFITTING & CURVE-FITTING DETECTION


================================================================
Overfitting is the process where a model learns the random noise or specific
idiosyncrasies of the training sample as if they were generalizable signal. The
model's complexity exceeds the information content of the data.

Learning Noise vs. Structure:


A model with many parameters can arrange itself to perfectly fit the training data,
including the random fluctuations. The error on the training set goes to zero.
However, on new data, the random fluctuations are different, so the model performs
poorly. The model has high variance and low bias. In trading, "noise" includes
microstructural artifacts, one-off news events, and liquidity anomalies that will
not repeat.

Parameter Sensitivity Analysis:


A robust strategy should perform reasonably well across a range of parameter
values, not just at a single, precise optimum.

· Method: Define a grid of parameter values. Run the backtest for each combination.
Plot the performance metric (e.g., Sharpe ratio) as a function of the parameters.
· Healthy Result: A wide, flat plateau where performance is stable. Small changes
in parameters cause small changes in performance.
· Overfit Result: A narrow, sharp peak. Performance is excellent at one exact
combination but falls off dramatically with tiny perturbations. This indicates the
strategy is tuned to a precise coincidence in the historical data.

Performance Cliffs:
Related to sensitivity. A small change in a parameter causes a catastrophic drop in
performance (e.g., Sharpe from 2.0 to -1.0). This is a clear sign of instability
and reliance on a fragile historical alignment.

Degenerate Parameter Zones:


Areas of the parameter space where the strategy's logic breaks down in a non-linear
way. Examples:

· A moving average crossover strategy where the short window length equals the long
window length (no signals).
· A volatility breakout strategy where the multiplier is set to zero.
The optimization algorithm must be constrained to avoid these zones, but their
existence near the optimum is a warning sign.

Why Smooth Equity Curves Are Suspicious:


A perfectly smooth, upward-sloping equity curve in a backtest is almost certainly a
product of overfitting or a massive hidden bias (like look-ahead). Real trading
involves variance. A healthy equity curve should show periods of drawdown, even
during profitable overall periods. The smoothness indicates the model has been
crafted to avoid every historical loss, which is impossible prospectively. Metrics
like the "Profit to Drawdown" ratio that seem too good to be true (e.g., > 10)
usually are.

Robustness > Peak Return:


The objective of strategy development should not be to maximize the Sharpe ratio or
total return in-sample. The objective should be to maximize the probability that
the strategy will remain profitable out-of-sample and live. This is achieved by
favoring simplicity, parsimony, and strategies that perform well across a broad
parameter space and multiple historical regimes. A strategy with a backtest Sharpe
of 1.5 that is robust is far superior to a strategy with a Sharpe of 3.0 that is
highly sensitive.

================================================================

[BOX 4] EXECUTION REALISM & MICROSTRUCTURE EFFECTS


================================================================
The backtest exists in a frictionless, continuous-time fantasy. Live trading occurs
in a discrete, asynchronous, and adversarial environment with frictions. Ignoring
this gap is the most direct path from a promising backtest to live ruin.

Slippage Modeling:
Slippage is the difference between the intended execution price and the actual fill
price. It is not zero, and it is not symmetric.

· Model: Slippage must be modeled as a stochastic process. A basic but effective


model: Slippage = (Spread/2) + (K * σ_tick * sqrt(OrderSize / AvgTradeSize)).
· Spread/2: The cost of crossing the bid-ask spread (for a market order).
· K: A constant (e.g., 0.5) scaling the market impact term.
· σ_tick: The volatility of tick-to-tick price changes.
· OrderSize / AvgTradeSize: Relative size of the order. Large orders relative to
typical trade size incur more impact.
· Implementation in Backtest: For each simulated trade, draw a slippage value from
a distribution calibrated to historical trade data or broker reports. Apply it to
the entry and exit. Always assume you pay the spread (buy at Ask, sell at Bid).

Spread Dynamics:
The bid-ask spread is not constant. It widens during:

· Low-liquidity sessions (Asian for EURUSD).


· High market volatility.
· Around news events.
· During market stress.
A backtest must use historical spread data or a realistic model of spread
dynamics (e.g., spread as a function of volatility and time of day). Using a fixed,
tight spread (like 0.1 pip for EURUSD) is a fatal error.

Latency Assumptions:
In a backtest, the signal is generated and executed instantly at the bar's close
price. In reality:

· There is a delay between signal calculation and order transmission (system


latency).
· There is a delay between order transmission and exchange acceptance (network
latency).
· The price may have moved during this delay.
· Modeling: Introduce a random latency delay (e.g., 10-500ms, distribution based on
system measurements) and use the future price after that delay for execution. This
often turns marginally profitable strategies unprofitable.

Partial Fills:
For larger orders or in thin markets, an order may not be filled entirely at once.
The backtest must simulate a partial fill logic, where the remainder of the order
sits in the book, potentially at a worse price, affecting the average fill price.

Why Ignoring Execution Turns Winners Into Losers:


A strategy with a small positive expectancy (e.g., 0.1% per trade) can be
completely erased by transaction costs (spread + commission + slippage) that
average 0.15% per trade. The backtest shows a profit; live trading shows a steady
loss. The reality gap here is 100% of the strategy's edge.

Session-Based Execution Degradation:


Execution quality is not uniform. A strategy that generates many signals during the
Asian session will suffer higher relative costs (wider spreads, higher slippage due
to lower depth) than the same signals during the London overlap. A realistic
backtest must apply session-aware cost models. If a strategy's edge is primarily
derived from trading in low-cost environments, it may be illusory.

================================================================

[BOX 5] METRIC SELECTION BEYOND PnL


================================================================
PnL is a noisy, lagging, and incomplete measure of system health. Relying solely on
cumulative profit or Sharpe ratio for validation is like flying a plane using only
the altimeter, ignoring fuel, engine temperature, and airspeed.

Expectancy Distribution:
The full statistical distribution of trade outcomes (P&L per trade) contains
critical information not captured by the mean (expectancy).

· Analyze: Histogram, kernel density estimate.


· Look For:
· Skewness: Positive skew (many small losses, few large wins) is typical of
trend-following. Negative skew (many small wins, few large losses) is dangerous
(e.g., selling options).
· Kurtosis (Fat Tails): High kurtosis means more extreme outcomes than a normal
distribution predicts. This indicates tail risk. A strategy with high positive
kurtosis may have "black swan" vulnerability.
· Multimodality: Multiple peaks in the distribution suggest the strategy behaves
differently in distinct market states (e.g., one mode for trending wins, another
for ranging losses).

Drawdown Depth & Duration:

· Max Drawdown (MDD): The largest peak-to-trough decline. Important, but


insufficient.
· Average Drawdown Duration: How long does the system typically stay in a drawdown?
Long recovery periods increase risk of abandonment and compound opportunity cost.
· Time Under Water: The percentage of time the equity curve is below its last peak.
A strategy with a high time under water, even if ultimately profitable, may be
psychologically and operationally unsustainable.
· Drawdown Recovery Profile: Is recovery slow and steady or rapid and volatile? The
shape of recovery matters for capital allocation decisions.

Tail Risk Exposure:


Metrics that quantify exposure to extreme losses.

· Conditional Value at Risk (CVaR): The average loss on the worst X% of days (e.g.,
5%). More informative than VaR because it considers the severity of losses in the
tail.
· Ulcer Index: Measures the depth and duration of drawdowns. Penalizes deep and
long drawdowns more than shallow, short ones.
· Max Consecutive Losses & Max Adverse Excursion: The worst string of losses and
the largest intra-trade loss observed. These are stress tests for the system's risk
management.

Trade Frequency Stability:


The number of trades per unit time (day, week, month) should be relatively stable
or predictable. Large, unexplained drops in frequency may indicate the strategy's
edge condition has vanished. Large spikes may indicate the strategy is overtrading
in a new, unsuitable regime. Monitor the rolling standard deviation of trade
frequency.

Why Good Systems Can Look Bad Temporarily:


Even a robust system with positive expectancy will experience strings of losses and
extended drawdowns due to statistical variance and unfavorable regimes. Evaluating
it over a short, unfavorable period (e.g., 3 months) may show negative performance,
leading to premature rejection. Validation must use sufficiently long OOS periods
in WFA to capture multiple market states.

Why Bad Systems Can Look Good Briefly:


A poorly constructed strategy can generate spectacular returns over a limited time
by accidentally aligning with a strong trend or by taking on hidden tail risk that
hasn't yet materialized (e.g., selling volatility before a crash). Short-term PnL
is a noisy and often misleading signal. The metrics above (distribution, drawdown,
tail risk) are designed to detect these pathological cases before live capital is
committed.

================================================================

[BOX 6] FORWARD TESTING & PAPER TRADING PHASE


================================================================
Forward testing (also known as paper trading or simulated trading) is the mandatory
intermediary step between a validated backtest and live deployment. It runs the
fully automated strategy on live, real-time data but with simulated execution and
no real capital at risk.

Paper Trading Limitations (The Simulator Gap):

1. No Market Impact: The simulator assumes your paper orders are filled without
moving the market. In reality, a large live order would.
2. Perfect Liquidity Assumption: The simulator assumes infinite liquidity at the
quoted bid/ask, which may not be true for large sizes.
3. Psychological Disconnect: There is no emotional weight to losses, which can lead
to ignoring behavioral flaws that will appear under real monetary pressure.
4. Slippage Modeling Imperfection: While you can add a slippage model, it is still
a model. Real slippage includes unpredictable elements like sudden latency spikes
or broker-specific issues.
Despite these limitations, forward testing is invaluable for uncovering logical,
datafeed, and timing errors that backtests miss.

Live Data, Simulated Execution:


The system must be integrated with a live market data feed. All signal generation
logic, including any machine learning models that retrain online, must operate
exactly as they will in production. Orders are sent to a simulated broker or a
paper trading account. Every aspect of the execution pipeline (order manager, risk
checks) is exercised.

Monitoring Behavioral Drift:


In forward testing, monitor for discrepancies between backtest expectations and
simulated results.

· Signal Generation Frequency: Does it match the backtest's predicted frequency for
the current regime?
· Fill Assumptions: Are simulated fills occurring at prices consistent with the
backtest's execution model? If not, the execution model is wrong.
· Latency and System Timing: Are there unexpected delays causing missed signals or
stale data usage?

Why Forward Test Failures Are Valuable:


A failure in forward testing (e.g., the strategy loses simulated money, or a
critical error occurs) is a success of the validation process. It has exposed a
flaw before real capital was lost. Each failure must trigger a rigorous post-mortem
and a return to the research/backtest phase. The strategy is not ready for live
capital until it passes a meaningful duration of forward testing (e.g., 3-6 months,
or at least 2 full regime cycles) with performance metrics that align with OOS
expectations within the reality-gap tolerance.

When to Abort Before Capital Loss:


Abort the forward test and reject the strategy for live deployment if any of the
following occur:

1. Statistical Divergence: The forward test Sharpe ratio, win rate, or max drawdown
are statistically significantly worse (p < 0.05) than the OOS walk-forward results,
after accounting for the more conservative execution model.
2. Catastrophic Error: A bug causes a clearly irrational trade (e.g., enormous
position size, trading during news blackout).
3. Persistent Logic Failure: The strategy generates no signals for an extended
period when the backtest predicted it should, indicating a fundamental flaw in the
signal generation logic's live data handling.

================================================================

[BOX 7] LIVE DEPLOYMENT PHASE & CAPITAL RAMP-UP


================================================================
The transition from simulated to real capital is the highest-risk phase. A
strategy, no matter how well validated, is still a hypothesis. Capital must be
deployed in stages contingent on continued confirmation of that hypothesis.

Staged Deployment Logic (Capital Scaling):


Never deploy 100% of the allocated strategy capital on day one. Use a phased
approach where each phase is a conditional gate based on live performance.

· Phase 0 - Forward Test: 0% real capital. Required passage criteria: Duration


(e.g., 3 months), performance within bounds, no critical errors.
· Phase 1 - Minimal Viable Capital (MVC): Deploy a tiny fraction of the target
allocation (e.g., 1-5%). Purpose: To test the actual execution environment—real
fills, real slippage, real broker interaction—with negligible risk. This phase is
about validating the execution pipeline, not the strategy's edge.
· Phase 2 - Scaled Capital (e.g., 25%): Upon successful completion of Phase 1
(e.g., after N trades or M days with execution quality metrics in line with
models), increase allocation. This phase tests whether the strategy's statistical
edge holds under real monetary pressure and with slightly larger market impact.
· Phase 3 - Full Allocation (100%): Final ramp-up after Phase 2 confirms positive
expectancy and robust execution.

Performance Confidence Thresholds for Ramp-Up:


Define quantitative gates for moving from Phase N to Phase N+1.

· Gate 1 - Execution Quality: Realized slippage and spread costs are within X% of
the forward test model.
· Gate 2 - Statistical Performance: Over the last K trades in the live phase, the
rolling Sharpe ratio is > S_min and the max drawdown is < DD_max. These thresholds
should be derived from the OOS and forward test distributions.
· Gate 3 - Behavioral Consistency: No violations of risk limits or system rules.

Risk Ramp Rules:


The position sizing logic itself should have a built-in "live start" modifier. Even
when the orchestrator allocates 100% of the strategy's capital, the strategy's
internal risk-per-trade calculation should start at a reduced level and scale up
gradually.

· Example: Live_Risk_Multiplier = min(1.0, (Number_of_Live_Trades / 50)). For the


first 50 live trades, the risk per trade scales linearly from 0 to the full target.

Why Full Capital Deployment Too Early is Fatal:


If an undetected flaw exists—be it in the strategy logic, the execution system, or
the data pipeline—deploying full capital maximizes the damage. The resulting loss
can destroy the capital base or breach the system's maximum drawdown tolerance,
forcing a full shutdown. Phased deployment contains the blast radius of any
failure.

Capital as Validation Amplifier:


The presence of real capital is the ultimate test. It reveals:

· Psychological Biases in Code: Even automated systems can have code that behaves
differently under the stress of real PnL updates (e.g., overly aggressive loss-
recovery logic).
· Broker/Exchange Interactions: Margin calls, order rejections, connectivity issues
under load.
· Market Impact: At larger sizes, your own orders may begin to affect the market in
a way that invalidates the strategy's assumptions (e.g., a mean-reversion strategy
that itself provides liquidity and dampens moves).
Each phase of capital increase is a new experiment that must confirm the
hypothesis before proceeding.

================================================================

[BOX 8] REALITY-GAP MONITORING


================================================================
Once live, the system must continuously monitor the divergence between expected
performance (based on backtest/OOS/forward test) and actual performance. This is
not passive observation; it is an active surveillance system for model
invalidation.
Performance Decay Metrics:

· Rolling Performance vs. Benchmark: Calculate a rolling Sharpe ratio, win rate,
and profit factor over a window (e.g., last 50 trades or 3 months). Compare this to
the distribution of the same metric from the OOS walk-forward blocks.
· Z-score of Live Performance: Z = (Live_Metric - Mean_OOS) / StdDev_OOS. A large
negative Z-score (e.g., Z < -2) indicates live performance is an outlier on the
downside, suggesting degradation.
· CUSUM (Cumulative Sum) Chart: A statistical process control tool that
cumulatively sums the difference between each trade's return and the expected mean
return. A sustained drift away from zero signals a shift in the process mean (i.e.,
the edge has changed).

Slippage Drift:
Monitor the realized slippage (entry and exit) and compare it to the model used in
the backtest/forward test.

· Metric: Slippage_Ratio = Realized_Slippage / Modeled_Slippage. A sustained


Slippage_Ratio > 1.5 indicates the execution environment is worse than modeled,
eroding edge. This could be due to increased market friction, poorer order routing,
or increased latency.

Signal Frequency Drift:


Compare the actual rate of signal generation to the expected rate given the current
market regime (as classified by the system's own regime detector).

· Detection: If the regime detector says we are in RANGING, and the historical
frequency for Strategy S_i in RANGING is 5 signals/week, but the live frequency is
20 signals/week, this indicates either the regime detector is wrong, or the
strategy's logic is behaving differently (perhaps due to a data issue or parameter
drift).

Early Detection of Model Invalidation:


The goal is to detect a structural break in the strategy's edge before it causes a
catastrophic drawdown. The monitoring system should generate alerts, not just logs.

· Alert Condition 1: Z-score of Sharpe (20 trades) < -2.0.


· Alert Condition 2: CUSUM chart exceeds control limits.
· Alert Condition 3: Slippage_Ratio > 2.0 for last 10 trades.
Upon alert, the system should automatically downgrade to a more conservative
state (reduce capital allocation, tighten risk limits) while the issue is
diagnosed.

Difference Between Noise and Structural Break:

· Noise: A run of 5 losing trades for a strategy with a 50% win rate. This is
within expected variance. The performance metrics (Sharpe, CUSUM) will fluctuate
but not trend systematically.
· Structural Break: The underlying market dynamics that the strategy exploits have
permanently changed. This manifests as a sustained, directional drift in
performance metrics (CUSUM), a persistent change in signal frequency, and a
degradation in win rate or profit factor that extends beyond the expected
confidence intervals derived from the OOS period. Statistical tests (like Chow
test) can be applied retrospectively to identify breakpoints.

================================================================

[BOX 9] KILL CRITERIA & ROLLBACK PROTOCOL


================================================================
Every strategy must have predefined, quantitative conditions under which it will be
deactivated (killed) and its capital withdrawn. This is not a failure of the
strategy per se, but the successful execution of a risk management protocol.

Statistical Invalidation Kill Criteria:


Formal hypothesis tests applied to live data stream.

· Primary Test - Profitability: IF (Live_Expectancy over last N trades is


statistically less than E_min with confidence p < 0.05) THEN {KILL}; Where E_min is
the minimum acceptable expectancy (could be zero or slightly positive to cover
costs).
· Secondary Test - Risk Adjusted: IF (Live_Sharpe over last M days is statistically
less than S_min with p < 0.05) THEN {KILL};
· Tertiary Test - Drawdown: IF (Strategy_Drawdown > MDD_Tolerance) THEN {KILL};
(This is a hard, non-statistical limit).

Behavioral Breach Kill Criteria:


The strategy violates its declared operational parameters.

· Example: A strategy declared for RANGING regimes only is found to have taken 80%
of its recent trades while the system was in TRENDING regime. This indicates a flaw
in the strategy's own filters or in the regime detection interaction.
· Example: The strategy's average hold time deviates by more than 50% from its
historical norm, suggesting its exit logic is malfunctioning.

Regime Incompatibility Kill Criteria:


The market has entered a regime for which the strategy is not designed and is
expected to remain in that regime.

· IF (Current_Regime NOT in Strategy.Valid_Regimes AND Regime_Stability_Score > 0.8


AND Time_in_Regime > Strategy_Hold_Period) THEN {KILL};
This allows the strategy to temporarily endure a regime shift, but if the shift
is stable and prolonged, it is deactivated.

Why Rollback is Success, Not Failure:


A rollback (deactivating the strategy, closing positions, reverting to a prior
stable version or to cash) is the system correctly executing its primary mandate:
capital preservation. It is evidence that the validation and monitoring framework
is working. A system that lacks kill criteria or ignores them will continue to
bleed capital until manually stopped, which is the true failure.

Version Control for Strategies:


Each strategy must have a unique version identifier (e.g., S_Trend_V2.1.3). The
version encompasses all code, parameters, and metadata (M_i). When a strategy is
killed, it is not deleted. It is archived with its full version tag and a record of
its live performance up to the kill point. This allows for:

1. Post-Mortem Analysis: Comparing the failed live version with its backtest to
understand the reality gap.
2. Rollback Target: The system can revert to a previous, stable version of the same
strategy if the new version fails.
3. Research Continuity: The data informs future research about what types of edges
decay and under what conditions.

================================================================

[BOX 10] VALIDATION GOVERNANCE & AUDITABILITY


================================================================
The process of research, validation, and deployment must be governed by strict
protocols that prevent contamination, ensure reproducibility, and allow complete
traceability of all decisions.

Separation of Roles (Conceptual or Functional):

· Research/Development: Creates new strategies, explores ideas, runs initial


backtests. Has write access to the research environment but NOT to the validation
or production datasets.
· Validation/Quant: Owns the walk-forward analysis framework and the forward
testing environment. Receives strategy code and parameters from Research. Runs
independent validation tests on pristine OOS data. Has read-only access to research
data and write access to validation results.
· Production/Operations: Manages the live trading infrastructure. Receives
validated strategies and deployment instructions from Validation. Has no ability to
modify strategy logic or parameters; only executes.
This separation minimizes the risk of data snooping and conscious or unconscious
cheating.

Immutable Logs:
Every action in the research, validation, and live environments must be logged to
an immutable data store (e.g., write-once database, blockchain-style ledger). Logs
must include:

· Research: Every backtest run, with exact code version, parameter set, dataset
identifier, and results.
· Validation: Every walk-forward step, every forward test initiation/completion,
all performance metrics, and all decisions (pass/fail).
· Live Trading: Every tick of data received, every signal generated, every order
sent, every fill received, every system state change (regime, strategy
activation/kill).
These logs are the system's "black box" for post-mortem analysis.

Decision Traceability:
It must be possible to trace any live trade back through the entire decision chain.

· Trade ID 12345 -> Signal ID 67890 ->** Strategy Version S_X_V1.2 ->** Validation
Run ID VF_20231015_003 ->** Research Backtest ID BT_20230901_045.
· This traceability allows you to answer: "Why did we take this trade?" and "What
evidence supported the belief that this trade would be profitable?"

Post-Mortem Analysis Protocol:


When a strategy is killed or a significant anomaly occurs, a formal post-mortem is
triggered.

· Steps:
1. Assemble all relevant logs for the period.
2. Replay the strategy's logic on the recorded data (ensuring no look-ahead).
3. Compare the replay results with the live results to identify discrepancies
(execution errors).
4. Compare live performance with OOS validation performance to quantify the
reality gap.
5. Identify the root cause: Was it overfitting? A regime shift not captured in
OOS? An execution system failure? A data corruption event?
6. Document findings and update validation protocols or system defenses
accordingly.

Why Systems Without Audit Trails Repeat Mistakes:


If a strategy fails and the reason is not meticulously documented and understood,
the same class of error will inevitably recur. The research team will overfit
again, the validation team will miss the same flaw, or the ops team will repeat the
execution error. An immutable audit trail transforms failures from capital-
destroying events into valuable learning data that improves the entire system's
resilience. It enforces accountability and rigor at every stage of the lifecycle.

Common questions

Powered by AI

Paper trading's limitations include assuming no market impact from orders, assuming perfect liquidity, lacking emotional weight to losses, and imperfect slippage modeling. Despite these, it is valuable for uncovering logical, data feed, and timing errors that backtests miss . It allows for forward testing by integrating with live market data while avoiding real financial loss. Forward test failures help identify flaws before live capital is risked .

Psychological biases can be embedded in code, leading to potentially harmful behaviors like overly aggressive loss-recovery logic under real PnL stress. Live capital introduction tests for such biases, as it reveals how code and system processes adjust to real-time performance pressures that are absent in simulations . Observing system reactions to live capital can uncover previously hidden biases or errors in automation logic .

Phased capital deployment involves staging capital allocation based on live performance confirmation, acting as a risk management strategy by limiting initial exposure. It starts with 0% real capital (forward test), moving to minimal capital, then scaled capital, and finally full allocation based on satisfactory performance under real conditions . This approach reduces the impact of any undetected flaws in strategy logic or execution environment, containing potential losses .

The survivorship illusion in strategy development leads to a perception that finding a profitable strategy is easier than it is because only strategies that passed the backtest filter are visible, analogous to only publishing positive scientific results . This inflates the perceived success of strategies, as the unprofitable strategies that were discarded are not considered, similar to publication bias in science where only successful experiments are reported .

The main biases that compromise the integrity of a backtest include Look-Ahead Bias, Survivorship Bias, Cost Ignorance, Liquidity & Market Impact Assumption, and Data Snooping Bias. Look-Ahead Bias involves the model having access to information during backtest execution that wouldn't have been available in real-time . Survivorship Bias occurs when only surviving instruments are included in the dataset, biasing returns upward . Cost Ignorance is assuming execution at the modeled price with zero spread, commission, or slippage . Liquidity & Market Impact Assumption involves assuming infinite liquidity at historical prices, ignoring that large orders would move the market . Data Snooping Bias involves testing numerous ideas on the same dataset, which can lead to spurious correlations .

Slippage in backtests is modeled as a stochastic process to reflect the difference between intended execution prices and actual fill prices. A basic model includes slippage as the sum of half the spread and a factor based on volatility and order size relative to average trade size . Including slippage is crucial because it addresses the reality of trading frictions and ensures simulations more accurately reflect potential live trading conditions .

Walk-Forward Analysis (WFA) simulates the process of periodically recalibrating a model on recent data and then trading on future data, respecting the chronological order of data. It involves defining an in-sample (IS) period for optimization, followed by an out-of-sample (OOS) period for testing. The process is repeated by sliding the window forward . It is considered rigorous because it provides multiple independent OOS data points, respects temporal order, and tests the model's adaptability to changing conditions .

A perfectly smooth equity curve in a backtest is suspicious because it likely indicates overfitting or hidden biases, such as look-ahead bias. Real trading involves variance and periods of drawdown . The smoothness suggests the model has been crafted to avoid historical losses, which is improbable in prospective trading .

Monitoring the reality gap compares expected performance with actual performance, informing whether model assumptions hold in live trading. This active surveillance can reveal model invalidation when discrepancies occur, such as a significant negative Z-score or higher-than-modeled slippage ratios . Identifying these discrepancies early allows for adjusting risk management strategies, like reducing capital allocation, before serious losses occur .

Robustness and simplicity are preferred because they maximize the probability that a strategy will remain profitable out-of-sample and live. A complex strategy that maximizes peak returns is often sensitive to specific historical data, decreasing its long-term viability. Simple, parsimonious strategies that perform consistently across various parameters and historical regimes are more likely to be resilient to data changes and anomalies in live trading . Focusing on robustness ensures a more stable performance and reduces the risk of significant drawdowns .

You might also like