In part 1, I argued that the trade journal is the most important part of any algo trading bot, and described what mine records for every trade: the reason, the market around it, the fill, the path while it was open, and the exit, plus the decisions it didn't act on and every change I made.
Ten thousand rows of that don't give you answers on their own. Questions do. These are the ones I ask, roughly in the order I ask them.
A note before starting: none of this is about finding a magic setting. It's about finding out which part of a trade is going wrong, so that the fix goes in the right place.
1. How did the trades behave, not just end?
The first thing I look at is not profit. It's the shape of the trades.
For every closed trade, the log has its worst point (MAE) and its best point (MFE). Put those side by side for winners and losers and a few things become visible very quickly:
- How far do winning trades usually go against me before they work? If most winners never go more than a certain distance against the entry, a stop placed much further away isn't protecting anything. It's just making the losers bigger.
- How far do losing trades go in my favour first? If many losers were well in profit at some point, the entry was probably fine. The exit is where the money went.
- How quickly do winners reach their best point? With the price path recorded every few seconds, I can see whether the good part of a move usually comes in the first few minutes or builds slowly. That decides how patient an exit should be.
This one comparison says more about where stops belong than any amount of looking at individual charts.
2. How much of the move did I keep?
The second question is about exits. For each trade I compare the best point it reached with where it actually closed. The difference is what it gave back.
Looked at across hundreds of trades, this shows whether the exit rule is doing its job:
- If trades regularly reach a good profit and close near zero, the exit is too slow.
- If trades close early and then keep going, it's too quick.
- If the kept share is similar across different kinds of days, the exit is probably reasonable and the problem is somewhere else.
Because the full price path is stored, I don't have to guess what a different exit would have done. I can replay a different rule on the same recorded trades and compare. That's far faster than waiting months for new trades, though a rule that only looks good on old trades still has to prove itself on new ones.
3. What did the fills cost?
Slippage is the difference between the price the signal wanted and the price the order actually got. It's easy to ignore, because each trade's slippage looks small. Added up, it can be the difference between a strategy that works and one that doesn't.
The questions I ask of it:
- Is slippage worse in the first few minutes after 9:15, when spreads are wide and prices move fast?
- Is it worse on expiry day, or on options further from the current price?
- Is it worse for some order types than others?
- Most importantly, what's the gap between paper and live? The same setup, taken on paper and live, shows exactly what the real market charges. That gap is the honest cost of trading, and paper results should always be judged with it in mind.
4. Does it work in every kind of market?
This is where the minute-by-minute market snapshots earn their keep. Each trade is joined to what the market looked like when it was taken, and then the trades are split into groups:
- by time of day
- by days to expiry
- by how volatile the market was (India VIX)
- by whether the day opened with a big gap
- by how close the entry was to an important price level
Then the same two numbers are compared across groups: the average trade, and the worst trades. A strategy that does well overall can be carrying one kind of day that loses steadily. Finding that group, and simply not trading it, is often worth more than any change to the strategy itself.
The trap is small groups. Slice the data finely enough and some slice will look amazing by chance. A pattern has to show up across many days, and ideally on trades that came after I spotted it, before I act on it.
5. Were the filters right?
Every filter and risk check blocks some trades. The question is whether it blocks the right ones.
Because blocked signals are recorded with the rule, the reason and the market at that moment, I can follow each one on the recorded prices as if it had been taken, and compare those "shadow trades" with the ones that went through:
- If blocked signals would have done worse than the trades that were taken, the filter is doing its job.
- If they would have done about the same, the filter is just reducing the number of trades.
- If they would have done better, the filter is costing money, however sensible it sounded when I added it.
The same idea works during a trade. The part of the bot that watches for exits records a hold, warn or exit call every few seconds — more than 200,000 of them so far. Lining those calls up with what the price did next shows whether a warning actually meant something, or was just noise.
6. Was it the strategy, or was it me?
When results change, the change log is the first place to look. Every switch between paper and live, every strategy turned on or off, every quantity change and every manual exit is there with a timestamp.
Two questions come out of it:
- Did performance change right after something I did? A dip that starts the day I changed a setting is a very different problem from a dip that starts when the market changed.
- Did my manual exits help? With the price path recorded, I can compare each exit I made by hand with what the rule-based exit would have done. It's an uncomfortable comparison, and a very useful one.
7. Can I trust the data?
Before any of the above, the data itself needs checking. These are the checks worth running:
- Coverage. For each field, what share of trades actually has a value, week by week? My own check turned up that only about one trade in ten has the full stop and excursion detail, and that three columns I added for later analysis have never been filled. A result built on a column that's mostly empty describes a tiny, possibly unusual, part of the trades.
- Consistent labels. The same value written two ways ("LIVE" and "live") splits one group into two.
- Duplicates. A restart in the middle of the day can write the same trade twice.
- Paper and live kept apart. Every result is worked out separately for each.
Making the log easy to analyse later
A lot of this analysis will be done by scripts, and increasingly with an AI assistant writing the queries. Either way, the same few things make the data easy to work with:
- A short data dictionary. One line per field: what it means, its unit (points or percent, rupees or premium), and when it's written.
- Stable names and units. Renaming a column halfway through the year breaks every query that used it.
- IDs that link everything. One trade ID that connects the trade row, its price path, its market snapshots and any blocked or warning decisions.
- Plain formats. A SQLite file or CSV export will still open in ten years. A dashboard might not.
- A record of the questions already asked. What was checked, what it showed, and when. It saves running the same analysis twice and fooling yourself the second time.
What I'd do if I started again
- Look at behaviour before results. How far trades go for and against you says more than the profit column.
- Compare groups, not single trades. One bad trade is a story. Fifty similar bad trades are a finding.
- Test the filters as hard as the strategy. Every rule that blocks trades has a cost that only shows up if you record what it blocked.
- Check the data first. An analysis is only as good as the columns it stands on.
If you haven't read it, part 1 covers what I record for every trade and why. For how the first strategy behind these trades was built and tested, see the opening range breakout in 25 versions.