← The essay My trading journal updates itself every night. Here is how I built it. Open in a tab ↗
Reports · Real stories · October 2026

My trading journal updates itself every night. Here is how I built it

I had an AI coding agent build a private trading journal from my MT5 history. It reads my trades, never touches an order, and rebuilds itself while I sleep. Explore the real dashboard, test how many trades a number needs, and leave with the prompt for your own.

See how it works

Trading is a numbers game, and nobody can remember every trade. Without a journal, decisions rest on how the last few trades felt, and improving your trading becomes unnecessarily hard.

Claude Code built this journal on my own computer in about 15 minutes. The agent wrote the code once. Every night since, a short Python script does the work, with no model involved and nothing to pay.

The walkthrough

Built once by an agent, rebuilt every night without one.

Five steps, from the first prompt to tomorrow morning's dashboard.

Step 1 · Built once

A coding agent writes the script

I described the journal in one prompt. Claude Code wrote, ran and tested the code on my machine: the core in about 15 minutes, then most of an hour of extensions.

The whole session used 168,000 output tokens, about ten US dollars at API prices. On my plan it cost nothing extra.

Step 2 · Every night

At 23:30, a scheduled task runs it

Windows Task Scheduler starts a short Python script. No model, no tokens and no subscription: the refresh runs without Claude Code being open.

The computer has to be on and MT5 logged in. A missed night is caught up by the next run, because the script reads the full history each time.

Step 3 · Read-only

Five read functions, nothing else

Only one file imports the MT5 package, and it may call five read functions. A test fails if any other function appears in the code.

The password is never stored: the script reads from the terminal that is already logged in. Nothing flows back to the account.

Step 4 · Anonymised

Identifiers go before anything is saved

Account number, server, broker name and broker-specific symbol suffixes are dropped. Amounts become percentages or R-multiples.

A final check searches the output for those identifiers and refuses to write the file if any of them appear.

Step 5 · Written

A fresh dashboard, or yesterday's

The script writes a single file you open in a browser. When a refresh fails, it keeps the last working dashboard and writes the error to a log file.

The set-up described in the article. Arrows show the direction data moves; there is no path from the script back to the account.

The bench

Now explore the real dashboard.

This is the journal from the article, built on my own MT5 account and anonymised on import, so amounts appear only as percentages or R-multiples. Switch tabs, hover the charts, sort the trades.

Trading journal

Equity curve

Closed-trade balance, indexed to 100 at the first deposit. Deposits and withdrawals excluded.

Drawdown

Percentage below the previous peak of the equity index.

R and execution

R-multiple distribution

Number of trades per result bucket, in R, net of costs.

Risk per trade

Initial risk as a percentage of balance at entry, per trade in time order. Line = median.

Statistical significance

Is the edge distinguishable from zero, or could the result still be luck? Trades are treated as independent draws.

My own trades, from one personal account. History, shown to explain how the journal works: not advice and not an indication of future results. The equity index excludes deposits and withdrawals; Sharpe and Sortino use daily returns annualised with the square root of 252 and a risk-free rate of zero.

Finding 1 · Recency bias

Three wins in a row prove very little.

Our brains are poor judges of probability. We give too much weight to what happened last: a setup that wins three times in a row starts to feel like it always works, even if it only wins 40% of the time over a hundred trades.

Short-term results are largely luck. Given enough coin flips, five heads in a row is all but certain to happen somewhere. Set a win rate and a number of trades, and see how often a streak shows up anyway.

The chance of at least one winning streak, with no edge involved
0%

Exact probability for independent trades that each win with the same fixed chance, computed in your browser. A win rate of 50% is a fair coin.

Finding 2 · Sample size

Every slice of the data needs its own trades.

As a rough guide, treat 30 trades as the absolute minimum, 50 as preferable and 100 or more as the point where the data starts to become reliable.

The trap is that this applies to every slice. A hundred trades spread over five weekdays leaves 20 per day, which is not enough to conclude that Fridays are bad. Dropping Fridays anyway is overfitting: tailoring your rules to noise.

How many trades each slice gets, if they are spread evenly
30 or more trades per slicefewer than 30

Finding 3 · Luck or edge

A simple test tells luck from an edge.

Take your average result per trade, in R, and divide it by its standard error: the standard deviation of your results divided by the square root of the number of trades. That gives a t-statistic. The p-value is the probability of seeing results at least this good if there were no edge.

The usual threshold is a p-value below 0.05, for a single test planned in advance. It assumes your trades are independent and not extremely lopsided. Be stricter for anything you find by scanning many slices of the data.

A calculator for your own numbers
The defaults reproduce the article's example: 48 trades and a t-statistic of 3.41. Skewness 0 and kurtosis 3 describe symmetric results with normal tails; your journal may show other values, and they only change the minimum track record length.

Student's t with n − 1 degrees of freedom, one-sided. Minimum track record length after Bailey and López de Prado (2012), for a Sharpe ratio above zero at 95% confidence, on per-trade results, so the answer is a number of trades: 1 + [1 − skew · SR + (kurtosis − 1) ÷ 4 · SR²] · (z ÷ SR)², with SR = average ÷ standard deviation.

Finding 4 · Read the panel

Drawdowns compound against you.

Read the metrics as a panel rather than one at a time. The Sharpe ratio hides how lopsided your results are, and maximum drawdown hides how long it took to recover. If Sortino sits well above Sharpe, your results lean on occasional large winners; if the two are close, look for large losses hiding in your results.

On a few months of trades, treat these ratios as estimates. Andrew Lo showed in 2002 that serial correlation can overstate an annual Sharpe ratio by as much as 65% in the hedge fund examples he studied.

The gain needed to get back to where you were
25%

Gain needed = drawdown ÷ (1 − drawdown).

Finding 5 · Read-only by design

A test fails if any other function appears.

The Python package that connects to MT5 can also place and close trades. I told the agent to use only the functions that read history, and to add a test that fails if any order function appears in the code.

The agent proved the test works by temporarily adding a call to place an order, watching the test fail, and deleting it again. Try it: add a function to the MT5 module and run the test.

The MT5 module. Select functions to add or remove them

    The five read functions are the ones the journal uses. Order functions, and anything else not on the list, make the test fail.

    The experiment

    Write the prompt for your own journal.

    Choose your language, refresh schedule and server time zone. The prompt below is the standard one behind this kind of journal, with your three choices filled in. Paste it into Claude Code in an empty folder, with MT5 open and logged in.

    Windows and the MT5 desktop terminal only. The MT5 Python package does not work with the web terminal or on Mac and Linux. On a Mac, you can paste the prompt anyway and ask Claude Code whether it can build the same thing there; that route is untested. Claude Code needs a paid Claude plan or API credits.

    Nothing you choose here is stored or sent anywhere. When the dashboard is ready, check one metric by hand on five trades before you trust the rest.

    
            
          

    A journal is only progress when you come back to it.

    Every 30 trades, or at least once a month, analyse how your trading is doing and where it can improve. Otherwise you are tracking data for the sake of tracking data.

    For agents and sceptics

    Every number on this page, and where it came from.

    There is no simulation on this page. Every figure is the author's own anonymised data, a formula from the sources below, or computed in your browser from what you enter. Purple, which publishes Hello Purple, builds technology that connects AI agents to trading accounts.

    1. Yorben De Reuse, "My trading journal updates itself every night. Here is how I built it.", Hello Purple Reports, October 2026. The set-up, the build, the sample-size guide, the worked example and the prompt come from this piece.
    2. The dashboard on this page: the author's own MT5 account, closed trades only, . Anonymised on import: no account number, server, broker name or symbol suffix; amounts as percentages of equity or R-multiples; the equity index starts at 100. Server time assumed UTC+2 in winter and UTC+3 in summer.
    3. The journal's build log, kept by Claude Code during the build on 9 October 2026: the build times, the five allowed functions, the safety test, the anonymisation and leak check, and the generality audit.
    4. Andrew W. Lo, The Statistics of Sharpe Ratios, Financial Analysts Journal, 2002. The square-root rule for annualising holds only under special conditions; serial correlation overstated annual Sharpe ratios by as much as 65% in his hedge fund examples.https://rpc.cfainstitute.org/research/financial-analysts-journal/2002/the-statistics-of-sharpe-ratios
    5. David H. Bailey and Marcos López de Prado, The Sharpe Ratio Efficient Frontier, Journal of Risk, 2012. The minimum track record length, which grows with negative skewness and fat tails.https://ideas.repec.org/a/rsk/journ4/2223785.html
    6. pdmt5 documentation, a wrapper around the MetaTrader5 package, stating that the MetaTrader5 API requires Windows.https://pypi.org/project/pdmt5/
    7. Calculators on this page: the streak probability is exact for independent trades with a fixed win rate; slices assume an even spread; the significance test uses Student's t, one-sided; the recovery gain is drawdown ÷ (1 − drawdown).
    By email

    Get the next piece the day it is published.

    You are on the list. One email when a new report lands.

    One email when a new report lands, nothing else. By subscribing you agree to our privacy policy.