DEV Community

Travis Croft
Travis Croft

Posted on

Modeling prop-firm trailing drawdowns in 30 lines of Python

If you've ever built a backtester and then tried to use it to plan a prop-firm evaluation, you've probably hit this: the backtest says the strategy's worst drawdown is $1,700, the account allows $2,000, and the account still fails.

Usually the bug isn't in the strategy. It's that "max drawdown" in a backtest report and "max drawdown" in a prop firm's rulebook are different things. Firms use one of three conventions, and the difference only shows up when you simulate the floor, not the equity curve.

The three conventions

For a $50,000 account with $2,000 of drawdown:

Type Where the floor sits
Static $48,000, forever
Trailing, end-of-day $2,000 below your best closing balance
Trailing, intraday $2,000 below your best open equity, updated every tick

Most firms also stop trailing at some point (the floor "locks", often once it reaches the starting balance), and some never lock during the evaluation. That's a parameter too.

The simulator

Each day is a list of intraday equity marks (P&L relative to the start); the last mark is the close.

def run(path_by_day, start=50_000, dd=2_000, mode="eod", lock_at=None):
    """Return (day the account busted or None, final floor)."""
    floor = start - dd
    high = start  # best balance the floor trails from
    for day, marks in enumerate(path_by_day, 1):
        for m in marks:
            eq = start + m
            if mode == "intraday" and eq > high:
                high = eq
                floor = max(floor, high - dd)
            if lock_at is not None:
                floor = min(floor, lock_at)
            if eq <= floor:
                return day, floor
        close = start + marks[-1]
        if mode == "eod" and close > high:
            high = close
            floor = max(floor, high - dd)
            if lock_at is not None:
                floor = min(floor, lock_at)
    return None, floor
Enter fullscreen mode Exit fullscreen mode

The floor only ratchets up (max), and lock_at caps it, which is how most firms' "locks at starting balance" rule works.

Same trades, three outcomes

Day 1 runs up to +$1,800, then fades to close at +$300. Day 2 dips to โˆ’$1,500 and recovers to โˆ’$400.

days = [[600, 1_200, 1_800, 900, 300], [100, -700, -1_500, -400]]
for mode in ("static", "eod", "intraday"):
    bust, floor = run(days, mode=mode)
    print(f"{mode:9s} busted_on_day={bust}  floor={floor:,}")
Enter fullscreen mode Exit fullscreen mode
static    busted_on_day=None  floor=48,000
eod       busted_on_day=None  floor=48,300
intraday  busted_on_day=2  floor=49,800
Enter fullscreen mode Exit fullscreen mode

Under intraday trailing, the +$1,800 open peak dragged the floor to $49,800, and giving the gain back didn't drag it down again. Day 2's dip to $48,500 went through it. The other two conventions survive the exact same trades.

What this means for a backtest

  • Report the floor, not just max drawdown. Replay your trade list (with intraday excursions, MFE/MAE at minimum) through the firm's convention.
  • For intraday trailing, MFE matters as much as MAE: a trade that runs far in your favor and comes back costs you room even if it closes flat.
  • Express the floor distance in units of your risk per trade. $2,000 of room at $400 risk is only five consecutive losers, and a 55%-win strategy produces streaks like that a few times per few hundred trades.
  • Check other rules the same way: a daily loss limit (some firms fail the account, others just end the day) and consistency rules (best day โ‰ค 55% of total profit means total needed = best day รท 0.55).

A checklist version

I wrote the non-code version of this up as a free, printable checklist (rule sheet, the sizing math, a daily session routine, and a table of published rules for five firms as checked on 1 Oct 2026). Direct PDF, no email gate: Prop Firm Pass Checklist. Per-firm pages with day-by-day worked examples are at tradeflowquantum.com/evaluation-rules, and there's a free community for traders working through evaluations: Funded Trader Lab.

Disclosure: I build TradeFlow Quantum, a paid trading journal; everything linked above is free. This post was written with AI assistance and the code was run as shown. Educational only, not financial advice; firms change their rules, so check the firm's own page.

Top comments (0)