Define a loss and the sequence being measured
Set q to the assumed probability that one trade has negative net P&L after your chosen costs. The complementary outcome is a non-loss, which resets the run in this calculator. N is the number of trades in a fresh horizon; k is the minimum run length to count. A run of six losses satisfies a threshold of five. Each simulated path counts once, even if it contains several qualifying runs.
- For strictly win-or-loss trades, q = 1 - p where p is the assumed win probability. With break-even trades, 1 - win rate includes zeros and is not the negative-P&L frequency. Use loss count divided by all observations if zeros reset your run.
- Declare whether trades are ordered by entry, exit or another timestamp. Simultaneous trades need a reproducible tie rule. Three correlated positions opened together are not automatically three independent trials.
- If you exclude zero-P&L trades, redefine both N and q on the retained sequence. Removing them connects losses that were separated in the original sequence. Do not change the convention after seeing an inconvenient result.
- The calculator starts without an existing losing streak. It does not answer how likely a current four-loss streak is to reach five on the next trade. Under independence that conditional probability is q.
One fixed block and a run anywhere are different events
For independent trials, q^k is the chance that every trade in a specified block of k trades loses. It imposes no condition on the trades before or after that block, so it is not the probability of a maximal run of exactly k losses. The horizon event is P(L_N ≥ k), where L_N is the longest losing run among N trades.
- The windows covering trades 1 to 2 and trades 2 to 3 share trade 2. Their intersection is LLL, with probability 1/8, not 1/16. Inclusion-exclusion gives 1/4 + 1/4 - 1/8 = 3/8.
- Expected window count is also a different quantity. For N ≥ k, (N - k + 1)q^k counts expected all-loss windows, including overlaps. It can exceed one and cannot be reported as a probability.
| Question | q = 50%, N = 3, k = 2 | Reason |
|---|
| Do the first two trades both lose? | 25% | LLW and LLL out of eight equally likely paths. |
| Do at least two consecutive losses occur anywhere? | 37.5% | LLW, WLL and LLL out of eight paths. |
| Treat both overlapping windows as independent? | 43.75%, incorrect | 1 - (1 - 0.25)² double-counts dependence between the windows. |
The exact run-length recurrence
Let a_t(j) be the probability that no qualifying run has occurred after t trades and the current trailing losing run has length j, for j = 0, ..., k - 1. Initialize a_0(0) = 1 and all other states to zero. A non-loss resets the trailing length; a loss extends it. Kessler and Schiff derive a related exact Bernoulli run recurrence using a partition of the possible initial outcomes. The calculator uses the state formulation below.
- a_(t+1)(0) = (1 - q) × Σ[j = 0 to k - 1] a_t(j).
- a_(t+1)(j) = q × a_t(j - 1), for j = 1, ..., k - 1.
- P(L_N ≥ k) = 1 - Σ[j = 0 to k - 1] a_N(j). The implementation accumulates first-hit mass q × a_t(k - 1) directly instead of subtracting nearly equal numbers for rare events.
- Once a path reaches k, it leaves the no-run states and is counted only once. The recurrence is exact under its model; the implementation uses finite-precision arithmetic. Extreme tails can underflow, and rounded output can approach 100%. For nondegenerate probabilities, a numeric zero is labeled below numeric precision and a numeric one is labeled approximately 100%; those are not exact boundary results.
| Boundary | Horizon probability | Interpretation |
|---|
| N = 0 or k > N | 0 | The horizon contains too few trades. |
| q = 0 | 0 | Losses cannot occur under the assumed model. |
| q = 1 and N ≥ k | 1 | Every trade loses. |
| k = 1 | 1 - (1 - q)^N under independence | At least one loss in the horizon. |
| N = k | q^k under independence | Only one full window fits. |
Change the horizon before changing your interpretation
Keep q = 50% and k = 5. The probability of a specified five-trade loss block stays at 3.125%, while the probability of encountering such a run increases with the number of trades. These are hypothetical model calculations, not observed trading results.
- Uncertainty in q also matters. For N = 100 and k = 5, independent results are 45.907367% at q = 40%, 81.010960% at q = 50%, and 97.583972% at q = 60%. This sensitivity grid is not a confidence interval for q.
- Choose N to match a stated future trade horizon. Increasing N merely because a historical streak already happened changes the question. Selecting the longest observed streak and then presenting its probability as a prespecified significance test is also misleading.
| Future trades N | Independent run probability | Markov scenario, ρ = 0.20 |
|---|
| 5 | 3.125000% | 6.480000% |
| 20 | 24.987030% | 40.894736% |
| 100 | 81.010960% | 95.041218% |
| 250 | 98.555174% | 99.952422% |
Test positive dependence while keeping the same loss rate
The sensitivity result uses a stationary two-state Markov model. Set a = P(loss | previous loss) = q + ρ(1 - q) and b = P(loss | previous non-loss) = q(1 - ρ). Start the first trade with loss probability q. Then qa + (1 - q)b = q, so the marginal loss probability stays fixed. For 0 < q < 1, the lag-one correlation of the loss indicator is ρ.
- At q = 0.50 and ρ = 0.20, a = 0.60 and b = 0.40. The calculator uses a after a trailing loss and b after a non-loss, with the same absorbing run threshold. At N = 100 and k = 5, the result is 95.041218%, compared with 81.010960% under independence.
- Positive dependence makes losses persist once started, but also makes non-losses persist. It does not increase every possible horizon event: with N = 2 and k = 1, q = 0.50 gives 75% under independence and 70% at ρ = 0.20.
- ρ is an assumed scenario, not an estimate extracted from your trades. This first-order model does not capture arbitrary clustering, changing market regimes or dependence among simultaneous positions. At q = 0 or 1, variance is zero and correlation is undefined; the outcomes are deterministic.
- Review rolling loss rates and trade grouping before using a pooled q. Compare results across plausible probabilities and dependence assumptions. No single sensitivity setting validates the strategy.
Use simulation to check arithmetic, not to validate the market model
The simulation button generates independent Bernoulli paths using the entered q, N and k. It deliberately ignores the Markov sensitivity input. It uses Mulberry32 with seed 20261018 and up to 10,000 paths, reducing the path count for long horizons to cap work at two million trial draws. Each path stops when it first reaches the threshold.
- For q = 50%, N = 100 and k = 5, the recorded 10,000-path run has 8,079 hits: 80.79%. The exact result is 81.010960%. The approximate 95% Wilson interval is 80.006104% to 81.550249%. Repeating identical inputs uses the same seed and returns the same check.
- The interval describes Monte Carlo sampling error conditional on the assumed model. It does not include error in historical q, dependence, execution assumptions or strategy selection. A 95% interval can miss the exact result in repeated experiments.
- Rare events may produce zero simulated hits even when the exact probability is positive. More replications reduce sampling noise, but they cannot repair an invalid model. Prefer the exact recurrence for this finite-state calculation.
Reconcile TradingView exports before using a report loss rate
TradingView exports each Strategy Report tab separately. Export List of Trades for individual trade records; the Performance Summary contains aggregate metrics. Confirm sample dates, closed-trade coverage, costs and ordering before counting losses. Backtest Deep Report imports trade records and calculates historical win rate and maximum consecutive losses, but those fields require a convention check before comparison with this calculator.
- In the report implementation reviewed on 2026-10-18, imported closed trades are sorted by entry time. The consecutive-loss counter advances on negative net P&L, resets on positive P&L, and leaves the count unchanged on zero P&L. This calculator instead treats every non-loss as a reset. If your analysis needs exit order or a different zero rule, compute the historical sequence explicitly.
- The report win rate counts strictly positive trades divided by all trades. When zeros exist, subtracting it from one overstates the frequency of strictly negative outcomes. Count losses directly under the convention selected for this study.
- The report Monte Carlo resamples individual trade P&L values with replacement. The fixed-q exact recurrence and Markov comparison on this page are separate calculations; do not assume they are built into the report.
- Pine Script AI Coding Agent can help draft custom trade diagnostics from an explicit specification. State the loss definition, costs, ordering and zero rule, then compare outputs with exported trades. Generated code and a historical fit do not establish stable future probabilities.
A losing streak probability does not measure risk of ruin
This calculator uses only loss/non-loss labels. It ignores the size of losses, profits between losses, leverage, margin calls and capital withdrawals. Risk of ruin concerns crossing a defined capital boundary and needs an equity-path model with position sizing and payoff assumptions. Accounts can breach a limit without consecutive losses, and equal-length streaks can have very different financial consequences.
- Under the special assumption that every loss removes a fixed fraction f of current equity, k losses in a row reduce equity by 1 - (1 - f)^k. Five full losses at f = 1% produce a 4.900995% decline from the start of that streak. Slippage, gaps or a different sizing rule change this calculation.
- An ordinary streak under one model is not evidence that a strategy remains sound. An unusual streak is not proof of a new regime. Review execution, costs, rule changes and an untouched evaluation sample before drawing a trading conclusion.