Page 2 of 2
Re: Why a good strategy can look terrible over twenty trades
Posted: Fri Nov 13, 2026 6:34 pm
by FTtrader
The Solution: Block Bootstrapping
Instead of drawing single random trades from your history, Block Bootstrapping draws random blocks of consecutive trades (e.g., chunks of 5 or 10 trades at a time). By keeping these historical chunks intact, the simulation naturally preserves the exact serial correlation, volatility clustering, and regime-specific streaks that actually occurred in the market.
Re: Why a good strategy can look terrible over twenty trades
Posted: Fri Nov 13, 2026 6:35 pm
by FTtrader
Python Implementation (Block Bootstrap)
This script modifies the previous NumPy engine to sample in blocks.
Code: Select all
import numpy as np
# 1. Load your historical trade returns (as decimal percentages)
historical_trades = np.array([0.015, -0.012, 0.015, 0.015, -0.012, -0.012, 0.015, -0.01, -0.01, 0.02])
# 2. Simulation parameters
simulations = 10000
sample_size = 500
block_size = 5 # The number of consecutive trades to sample together
multipliers = 1 + historical_trades
n_trades = len(multipliers)
# 3. Generate random starting indices for the blocks
# We need (sample_size / block_size) blocks per simulation
num_blocks = int(np.ceil(sample_size / block_size))
# Choose random starting points ensuring we don't read past the array end
start_indices = np.random.randint(0, n_trades - block_size + 1, size=(simulations, num_blocks))
# 4. Build the resampled simulations by slicing the blocks
# Create an empty array to hold the Monte Carlo results
mc_results = np.zeros((simulations, num_blocks * block_size))
for i in range(block_size):
# Populate the array by pulling consecutive trades offset by 'i'
mc_results[:, i::block_size] = multipliers[start_indices + i]
# Trim down to the exact sample size (in case num_blocks * block_size > sample_size)
mc_results = mc_results[:, :sample_size]
# 5. Calculate Compounding Equity and Drawdowns
equity_curves = np.cumprod(mc_results, axis=1)
running_max = np.maximum.accumulate(equity_curves, axis=1)
drawdowns = (running_max - equity_curves) / running_max
max_drawdowns_per_sim = np.max(drawdowns, axis=1)
# 6. Extract the Tail Risk
confidence_95_dd = np.percentile(max_drawdowns_per_sim, 95)
print(f"95% Worst-Case Block-Bootstrapped Drawdown: {confidence_95_dd * 100:.2f}%")
Re: Why a good strategy can look terrible over twenty trades
Posted: Fri Nov 13, 2026 6:35 pm
by FTtrader
Alternative: The Markov Chain Approach
If you want a purely parametric model instead of resampling past data, you can build a Markov Chain. This calculates the literal mathematical probability of transitioning between states based on your history.
You would map your trades to calculate two specific probabilities:
P(Win | Previous trade was a Win)
P(Loss | Previous trade was a Loss)
If your strategy is truly independent, P(Win | Win) will equal your overall win rate. But if your M15 liquidity sweep setups tend to fail in clusters during unfavorable overlapping sessions, P(Loss | Loss) will be significantly higher than your average loss rate. You can then program a Monte Carlo loop that uses these transition probabilities to generate the next simulated trade, explicitly forcing the streak dynamics into the simulation.
Re: Why a good strategy can look terrible over twenty trades
Posted: Fri Nov 13, 2026 6:37 pm
by FTtrader
To build a Markov Chain Monte Carlo (MCMC) simulator, you must first extract the transition matrix—the literal mathematical probability of moving from one state to another—from your IC Markets trade history.
For an anti-martingale strategy scaling on floating profits across 2 to 6-week series, P(Loss | Loss) is the most critical metric. If M15 liquidity sweeps tend to produce clustered false breakouts during overlapping choppy sessions, your P(Loss | Loss) will be significantly higher than your baseline loss rate.
Re: Why a good strategy can look terrible over twenty trades
Posted: Fri Nov 13, 2026 6:37 pm
by FTtrader
Here is the vectorized Python implementation. Rather than looping 5 million times (10,000 simulations × 500 trades), this script loops only 500 times, calculating the next state for all 10,000 alternate realities simultaneously at each time step. It will execute in fractions of a second on an Intel Core Ultra 7.
The Markov Chain Monte Carlo Engine
Code: Select all
import numpy as np
# 1. Load Historical Data (Replace with your raw IC Markets decimal returns)
# Positive = Win, Negative = Loss
returns = np.array([0.015, -0.012, 0.015, 0.015, -0.012, -0.012, 0.015, -0.01, -0.01, 0.02])
# 2. State Mapping & Transition Matrix Extraction
# Convert returns to binary states: 1 (Win), 0 (Loss)
states = (returns > 0).astype(int)
current_states = states[:-1]
next_states = states[1:]
w_w = np.sum((current_states == 1) & (next_states == 1))
w_l = np.sum((current_states == 1) & (next_states == 0))
l_w = np.sum((current_states == 0) & (next_states == 1))
l_l = np.sum((current_states == 0) & (next_states == 0))
# Transition Probabilities
p_w_given_w = w_w / (w_w + w_l) if (w_w + w_l) > 0 else 0
p_l_given_w = 1 - p_w_given_w
p_w_given_l = l_w / (l_w + l_l) if (l_w + l_l) > 0 else 0
p_l_given_l = 1 - p_w_given_l
print(f"--- Transition Matrix ---")
print(f"P(Win | Win): {p_w_given_w:.2%}")
print(f"P(Loss | Win): {p_l_given_w:.2%}")
print(f"P(Win | Loss): {p_w_given_l:.2%}")
print(f"P(Loss | Loss): {p_l_given_l:.2%}\n")
# Separate historical win and loss magnitudes for accurate resampling
wins = returns[returns > 0]
losses = returns[returns <= 0]
# 3. Simulation Parameters
simulations = 10000
sample_size = 500 # Number of trades in the simulated series
# Initialize matrices to hold the simulated states and returns
sim_states = np.zeros((simulations, sample_size), dtype=int)
sim_returns = np.zeros((simulations, sample_size))
# Set the initial state based on the overall historical win rate
global_win_rate = np.mean(states)
sim_states[:, 0] = np.random.choice([0, 1], size=simulations, p=[1 - global_win_rate, global_win_rate])
mask_w = sim_states[:, 0] == 1
sim_returns[mask_w, 0] = np.random.choice(wins, size=np.sum(mask_w), replace=True)
sim_returns[~mask_w, 0] = np.random.choice(losses, size=np.sum(~mask_w), replace=True)
# 4. Run the Vectorized Markov Chain
# Loop through the time steps, processing all 10,000 simulations simultaneously
for t in range(1, sample_size):
prev_states = sim_states[:, t-1]
# Generate random probabilities for this specific step across all simulations
rand_vals = np.random.rand(simulations)
# Determine the next state based on the transition matrix
next_is_win = np.where(
prev_states == 1,
rand_vals < p_w_given_w,
rand_vals < p_w_given_l
)
sim_states[:, t] = next_is_win.astype(int)
# Sample the actual return magnitudes based on the new state
w_count = np.sum(next_is_win)
l_count = simulations - w_count
if w_count > 0:
sim_returns[next_is_win, t] = np.random.choice(wins, size=w_count, replace=True)
if l_count > 0:
sim_returns[~next_is_win, t] = np.random.choice(losses, size=l_count, replace=True)
# 5. Compounding Equity and Drawdown Calculation
multipliers = 1 + sim_returns
equity_curves = np.cumprod(multipliers, axis=1)
running_max = np.maximum.accumulate(equity_curves, axis=1)
drawdowns = (running_max - equity_curves) / running_max
max_drawdowns_per_sim = np.max(drawdowns, axis=1)
# 6. Extract the Tail Risk
median_dd = np.percentile(max_drawdowns_per_sim, 50)
confidence_95_dd = np.percentile(max_drawdowns_per_sim, 95)
ruin_prob = np.mean(max_drawdowns_per_sim >= 0.20) * 100
print(f"--- MCMC Drawdown Analysis ({simulations} iterations) ---")
print(f"Median Expected Max Drawdown: {median_dd * 100:.2f}%")
print(f"95% Worst-Case Max Drawdown: {confidence_95_dd * 100:.2f}%")
print(f"Probability of hitting 20% DD: {ruin_prob:.2f}%")
Re: Why a good strategy can look terrible over twenty trades
Posted: Fri Nov 13, 2026 6:37 pm
by FTtrader
Analyzing the Transition Matrix Output
When you run this on your full trade history, compare P(Win | Win) against P(Win | Loss).
If P(Win | Loss) drops significantly below your overall win rate, it mathematically proves your strategy experiences mean-aversion during drawdowns (losses cluster).
If this is the case, injecting a dynamic circuit breaker—such as hard-stopping execution for the rest of the London session after two consecutive losses—will immediately suppress your P(Loss | Loss) probability and drastically flatten the 95% worst-case drawdown curve in the simulation.