Check your drawdown rules before each session and record the day's mode
Before you look for anything new, a script reads your equity log and your own drawdown rules and records today's mode: normal, reduced size or review-only. If the data is missing or stale, it records review-only and explains why.
How it works
- Write your drawdown rules as plain thresholds before you need them, for example: more than 5% below the equity peak means reduced size for new positions; more than 10% below, or three losing trades in a row, means review-only (no new positions until you've done a written review). The numbers are yours.
- Keep a daily equity log you update yourself: date, closing account value, the result of any trade closed that day, and any deposit or withdrawal (0 if none). Use your broker statement or export as the source; a sheet saved as a CSV works.
- A short script, which you can have a coding agent write, reads the log and rules each morning and works out the distance from peak, the losing streak and the date of the last entry.
- It records today's mode in your journal (normal, reduced or review-only) with the numbers and the rule that set it.
- If the log is missing, older than your limit or doesn't add up (a gap, a duplicate date, or a jump on a day with no closed trade or cash flow that is bigger than a tolerance you set), the script records review-only and the reason. Ordinary moves in open positions are not a failed check. It never assumes normal.
- You read the mode before your pre-market routine starts. Leaving review-only needs your written review and a dated line in the journal saying why, not just a new day.
Copy-paste prompt
Write a small Python script for my own pre-session check. It gives no trading advice and never suggests trades,
markets or securities.
Inputs: my equity log {{equity_log_csv}} (date, closing_value, closed_trade_results, deposit_withdrawal) and my rules
file {{rules_file}} (thresholds for "reduced" and "review-only", the losing-streak rule, the maximum data age in days
and {{jump_tolerance}}).
The script must:
1. Work out the current distance from the equity peak in percent (adjusting the peak for logged deposits and
withdrawals), the current losing streak in consecutive closed trades, and the date of the latest row.
2. Choose the mode, normal, reduced or review-only, using only my rules. Where rules conflict, the stricter mode wins.
3. Choose review-only, giving the reason, if the log is missing, older than the maximum data age, has duplicate or
missing dates, or shows a day-over-day jump that closed trades plus deposit_withdrawal cannot explain within
{{jump_tolerance}} on a day with no closed trade. Ordinary mark-to-market moves in open positions are not bad data.
4. Print the proposed journal line (date, mode, distance from peak, streak, the rule that applied, data checks passed
or failed) and append it to my journal file only when I confirm.
It must not connect to any broker or place orders, and must not change my rules file or my equity log.
Include three test cases with expected modes that I can check by hand.
Guardrails
- The thresholds are yours and written in advance; the script doesn't suggest or adjust them.
- Bad, stale or missing data means review-only. The script never falls back to normal.
- Where rules conflict, the stricter mode wins.
- It reads your own log and appends one line to your journal. It has no broker connection and cannot place orders.
- Only your own dated note gets you out of review-only, not the calendar.
What can go wrong
A drawdown rule written in the middle of a drawdown tends to be generous, which is why the thresholds have to exist on a calm day. The script only reads what you log. A deposit or withdrawal you forget to note will make a drawdown look smaller or larger, so the consistency check flags unexplained jumps instead of guessing. And a mode you don't read is just a log line: put it at the top of the routine, not in a file you open on Fridays.
Why it helps
Drawdown rules are easy to write and hard to follow, because the moment they apply is the moment you least want them to. Having the script work out the mode from your own log before the session moves the decision to a time and place where it's just arithmetic. Treating bad data as review-only closes the easiest loophole: "the numbers are probably fine."
How it fits with other entries
The sizing check (aft-0008) uses the mode to cap risk per trade on reduced days. Proving the script on hand-checked cases (aft-0036) applies directly to the three test cases in the prompt. The pre-trade checklist (aft-0015) can open with the mode, and the emotion check (aft-0026) is a natural part of the written review that ends review-only.
Where this comes from
A public post by Dan Kornas (@DanKornas) on X about an open-source collection of Claude skills whose swing workflow checks drawdown and discipline gates before any screening. One of those skills is a drawdown circuit-breaker. We kept the idea that risk comes before research and wrote our own minimal version around your thresholds and your log.
Source and references
Inspired by a public post by @DanKornas on X about an open-source collection of Claude skills that checks drawdown and discipline gates before any screening, one of which is a drawdown circuit-breaker. The modes, the stale-data rule and the journal line are our own adaptation and wording.
Original: Dan Kornas on x
- Post on an open-source skills toolkit that puts drawdown and discipline checks before research · Dan Kornas (@DanKornas) on X (checked 19 Oct 2026)
- drawdown-circuit-breaker skill (open source) · GitHub (checked 19 Oct 2026)
Spotted an error, or want your post removed? Email hello@agentsfortraders.com.
Educational content only. Not investment advice or a personal recommendation. No tickers, signals or trade alerts. Trading involves risk of loss.
Conteúdo exclusivamente educativo. Não constitui aconselhamento nem recomendação de investimento. Sem tickers, sinais ou alertas de negociação. Negociar envolve risco de perda.
Related use cases
Check position size and portfolio heat before you trade
Run a local Python script on your planned entry, stop and positions CSV, and paste only its stdout. The agent checks size, heat, theme concentration and, when present, correlation against your limits, and leaves the decision to you.
Discipline, checklists & psychologyRun your pre-trade checklist and log the answers
Before you place a trade, the agent asks your five checklist questions, flags chasing or names that are not in your plan, and gives you a timestamped log line to paste into your journal.
Discipline, checklists & psychologyFind what comes before your rule breaks with a pre-session state log
Before you trade, rate sleep, stress, mood and focus in a 20-second log. Each week an agent compares those ratings with your rule breaks and checklist skips, and shows a pattern only once the sample is big enough.
Agent ops: guardrails & costsMake your agent prove a new script works by running it, not describing it
When an agent builds or changes a tool you rely on, such as a sizing calculator or a journal stats script, finish by having it run your real command on hand-checked test cases and show the raw output against your expected numbers.
The Daily 3
Three agent workflows for swing traders, free, on US trading days.