Your trading journal logs outcomes, not habits. Add this one column
Most trading journals record profit and loss. The column that shows your habits is the time between a losing trade and your next entry. Here's how to calculate it in a spreadsheet or SQL, plus open-source journals worth a look.
Kevin PatelAI Solutions Engineer· 3 min read

I posted about trading journals last week, and the best reply wasn't mine. Someone pointed out that logging trades is the easy half. A green or red number tells you what happened. The gap between a loss and your next entry tells you why.
They're right, and it's a nice data problem. So here's the column most journals are missing, and how to compute it.
Why profit and loss isn't enough
The numbers on retail trading aren't kind. When EU regulators looked at CFD trading in 2018, they found 74 to 89% of retail accounts typically lost money. In India, a SEBI study of equity derivatives traders, as reported by Business Today in November, found the share of loss-makers rose from about 91% in the first year to over 95% for people trading four or more years in a row.
That second number is the interesting one. More experience, more losing. Whatever people are learning, it isn't coming from their P&L column.
The re-entry gap
The idea is simple: for every trade that follows a losing trade, measure the minutes between the losing trade's exit and the new trade's entry.
A short gap after a loss is the classic revenge trade, jumping back in to win it back. A long gap means you stepped away. Once you have the column, you can compare:
- your average gap after a loss vs after a win
- your win rate on trades taken within 10 minutes of a loss, compared with everything else
If that second number is worse, and for a lot of people it will be, you've found a habit, not a strategy problem.
In a spreadsheet
Say each row is one trade, sorted by time, with entry time in column A, exit time in B and profit or loss in C. In D3, put:
=IF(C2<0, ROUND((A3-B2)*1440), "")Then fill it down. Times in Sheets and Excel are stored as fractions of a day, so multiplying by 1440 gives minutes. The cell stays empty unless the trade before it lost money.
In SQL
If your trades live in a database, a window function does the same job across every trade at once. This is PostgreSQL:
SELECT
id,
entry_at,
pnl,
LAG(pnl) OVER w < 0 AS after_loss,
EXTRACT(EPOCH FROM entry_at - LAG(exit_at) OVER w) / 60 AS gap_minutes
FROM trades
WINDOW w AS (PARTITION BY account_id ORDER BY entry_at);LAG() looks at the previous row in the window, so each trade can see the one before it without a self-join. From there, a GROUP BY after_loss on top gives you the comparison in one query.
Open-source journals worth a look
If you'd rather not build it yourself:
- TradeTally (opens in a new tab), an Apache-2.0 trading journal you can self-host with Docker or use hosted. It imports from brokers like Interactive Brokers, Charles Schwab, thinkorswim, E*TRADE and Lightspeed, with Webull, OANDA, Tastytrade and Questrade in its release notes. It was actively updated in November.
- TradeNote (opens in a new tab), a popular GPL-3.0 journal, though its code hasn't been updated since April 2025.
- khata (opens in a new tab), built for Indian brokers. It's an early alpha and only supports Dhan so far.
Whichever you pick, connect brokers with read-only API keys where you can. A journal never needs permission to trade or withdraw.
Not financial advice. This is about understanding your own records, not picking trades.
Quick answers
What should a trading journal record?
The market, entry and exit times, size, the reason for the trade, whether you followed your plan, how you felt before entering, the result, and one lesson. Profit and loss alone doesn't show habits.
What is a revenge trade?
A trade taken quickly after a loss, mainly to win the money back rather than because the setup is good. A short gap between a losing exit and the next entry is a common sign of one.
How do I calculate time between trades in a spreadsheet?
With entry time in column A, exit time in B and profit or loss in C, use =IF(C2<0, ROUND((A3-B2)*1440), "") on the next row. It gives the minutes since a losing trade closed.
Is there a free open-source trading journal?
Yes. TradeTally is an Apache-2.0 trading journal you can self-host with Docker, and TradeNote is another open-source option, though it hasn't been updated recently.


