Pause Rules for an EA: How Many Losses in a Row Are Normal?

4 December 2026, 07:57
Frederic Jean Andre Jouillerot
0
7

Every EA eventually puts its owner in front of the same decision: a run of losses, and a hand hovering over the AutoTrading button. The problem is not the streak. It is that the decision is usually made at the worst moment, right after the losses, with no rule written beforehand. This post gives the arithmetic of losing streaks, a simple way to write a pause rule before going live, and an MQL5 script that measures your EA's current streak against that arithmetic.

1. How long a normal losing streak gets

Assume trades are independent and the win rate stays constant. The probability of seeing at least k losses in a row somewhere within 200 trades is then (exact calculation, not a simulation):

  • 40% win rate: 8 in a row 75%, 10 in a row 38%, 12 in a row 15%, 18 in a row below 1%.
  • 50% win rate: 6 in a row 80%, 8 in a row 32%, 10 in a row 9%, 14 in a row below 1%.

For a 40% win rate system, the median longest streak over 200 trades is 9 losses. A breakout system with a modest win rate and larger winners should therefore expect, not fear, a run of 8 or 9 losses in a sample of that size.

2. Why "it lost 6 times, switch it off" is not a rule

Over 200 trades, six losses in a row happen in 80% of cases for a 50% system and in 98.5% of cases for a 40% one. Switching off at 6 means switching off a system that is behaving exactly as its statistics predict. The decision is then taken on the least informative data available, the last few trades, and the next trades are not taken at all.

The reverse error exists too: refusing to ever stop. That is why the rule has to exist before the streak, not during it.

3. A pause rule written in advance

Three kinds of triggers, decided before the EA goes live:

  1. Behaviour: the EA does something its rules do not describe (orders outside the expected session, wrong lot size, repeated errors in the Experts log). Stop immediately, whatever the results.
  2. Environment: the conditions you tested under have changed (spread, commission, swap, server time, symbol specification). Stop and retest.
  3. Statistics: the losing streak or the drawdown goes beyond a level that your own figures make unlikely, for example below 1% probability over your evaluation horizon. Stop and investigate.

A streak inside the normal range triggers nothing. Writing the thresholds down, with the date, turns an emotional decision into a check.

4. A script to compare your streak with the arithmetic

This script reads the closed deals of the account (optionally filtered by magic number), counts the current and longest losing streaks, and prints the probability of seeing a streak at least that long over a horizon you choose, given the win rate of your backtest. Inputs are examples.

#property script_show_inputs
input long InpMagic = 0; // EA magic number (0 = all deals)
input double InpWinRate = 40.0; // win rate from your backtest, %
input int InpTrades = 200; // evaluation horizon, in trades

// Probability of at least k consecutive losses within n trades (loss probability q)
double StreakProbability(const int n,const double q,const int k)
  {
   if(k<=0)
      return(1.0);
   double st[],nw[];
   ArrayResize(st,k);
   ArrayResize(nw,k);
   ArrayInitialize(st,0.0);
   st[0]=1.0; // st[i] = probability of a current run of i losses
   double hit=0.0;
   for(int t=0;t<n;t++)
     {
      double total=0.0;
      for(int i=0;i<k;i++)
         total+=st[i];
      hit+=st[k-1]*q; // run reaches k: absorbed
      nw[0]=total*(1.0-q);
      for(int i=1;i<k;i++)
         nw[i]=st[i-1]*q;
      ArrayCopy(st,nw);
     }
   return(hit);
  }

void OnStart()
  {
   if(!HistorySelect(0,TimeCurrent()))
     {
      Print("HistorySelect failed, error ",GetLastError());
      return;
     }
   int total=HistoryDealsTotal();
   int current=0,longest=0,closed=0;
   for(int i=0;i<total;i++)
     {
      ulong ticket=HistoryDealGetTicket(i);
      if(ticket==0)
         continue;
      long entry=HistoryDealGetInteger(ticket,DEAL_ENTRY);
      if(entry!=DEAL_ENTRY_OUT && entry!=DEAL_ENTRY_OUT_BY)
         continue;
      if(InpMagic!=0 && HistoryDealGetInteger(ticket,DEAL_MAGIC)!=InpMagic)
         continue;
      double result=HistoryDealGetDouble(ticket,DEAL_PROFIT)
                   +HistoryDealGetDouble(ticket,DEAL_SWAP)
                   +HistoryDealGetDouble(ticket,DEAL_COMMISSION);
      closed++;
      if(result<0.0)
        {
         current++;
         if(current>longest)
            longest=current;
        }
      else
         current=0;
     }
   double q=1.0-InpWinRate/100.0;
   PrintFormat("Closed deals: %d | current losing streak: %d | longest: %d",closed,current,longest);
   int from=MathMax(longest,1);
   for(int k=from;k<from+5;k++)
      PrintFormat("P(at least %d losses in a row within %d trades, win rate %.1f%%) = %.1f%%",
                  k,InpTrades,InpWinRate,100.0*StreakProbability(InpTrades,q,k));
  }

Notes: each closing deal counts as one trade, so partial closes are counted separately; commission charged on the entry deal is not included in the result of the exit deal. Run it on a copy of the history you trust.

5. Limits of the arithmetic

  • Real trades are not always independent. Losses can cluster in a market regime that does not suit the strategy, which makes long streaks more likely than the table says.
  • The backtest win rate is itself an estimate. With a few hundred trades, the true value can be several points away.
  • A streak inside the normal range does not prove the edge still exists. It only means the streak alone is not evidence that it has gone.

Disclosure

I develop Titan Breakout, an H1 breakout Expert Advisor for MetaTrader 5, at Pipmaster France. Whatever EA you run, ours included, write the pause rule before the first live trade. Titan Breakout is free to download for backtesting: Titan Breakout.

The probabilities above are theoretical, computed under the stated assumptions. They are not the results of any real strategy or account. Trading leveraged products involves a high risk of capital loss. This is not investment advice.