You've seen how a bug can look just like a result. The last check in this course is a simple one: take a few of the code's trades and find them on a chart. By the end of this lesson, you'll know which trades to pick, what to check on each one, and the mismatches worth looking for first.
1 of 8
What you'll learn
- Pick a few trades. Take the first, the last, a win, a loss and anything odd.
- Match the time zone. Find each trade on a chart of the same market and time zone.
- Check four things. Compare the signal, entry, stop and target, and exit with the chart.
- Spot common mismatches. Rule out time zones, adjusted files, averages and entry bars.
- Find which side is wrong. Any difference means the code or your chart reading is off.
Exercise
- Pick five trades from your own test: the first, the last, a win, a loss and the biggest.
- Find each on a chart and check the signal, the entry, the levels and the exit.
- Write down any difference and which side was wrong.
- Then try the course quiz.
Quick check
1. Which trades are worth checking by hand?
2. Every trade on the chart is a few hours off from the code. What's the likely cause?
3. The code's entry equals the signal bar's close. What does that point to?
0 of 3 answered.
Finished this lesson?
Tick it off and keep your place
Read the full notes
To catch code mistakes, pick a few trades, find each on a chart in the same time zone, and check the signal, the entry, the stop and target, and the exit. Any difference means one side is wrong.
- Pick a few trades: the first, the last, a win, a loss and anything odd. Find each on a chart of the same market, in the same time zone (Hand testing versus computer testing).
- Check four things: the rule was met on the signal bar; the entry is the next bar's open; the An order that closes a trade if price reaches a level you set against it. It aims to limit the loss, but in a fast market it can fill at a worse price.More in the glossary and An exit order that closes a trade when price reaches a level you choose in your favour.More in the glossary sit where the rule says; the exit is the first bar that touched one.
- Made-up trade: signal 1 March (close 4,059.25 above the The average of the last few closing prices, worked out again on every candle and drawn as a line.More in the glossary 4,057.51); entry 2 March at 4,051.75; risk 1.5 × 62.30 = 93.45; stop 3,958.25, target 4,238.75; 11 March low 3,962.50, 4.25 One whole unit of a price. On the S&P 500, a move from 5,000 to 5,001 is one point, and each futures contract sets what a point is worth in dollars.More in the glossary clear; exit 15 March at the stop, no gap.
- Likely mismatches: time zone; a A continuous futures chart where older prices are moved by the gap at each roll, so the line joins up smoothly. Those older prices never really traded.More in the glossary file against an unadjusted chart; a different indicator average or length; an entry at the signal bar's close instead of the next open (A backtest mistake: using a price the strategy couldn’t have known yet at the moment it made its decision.More in the glossary).
- Close calls flip first when anything differs. Any difference means either the code or your reading of the chart is wrong: find out which.
Worked example
Made-up numbersChecking the levels by hand
Made-up numbers · entry 4,051.75 · An indicator that averages recent candles’ true ranges, so it shows how far price has been moving in each candle, in the same units as price.More in the glossary on the signal day 62.30 · stop 1.5 ATR · target 2 × risk
- Risk: 1.5 × 62.30 = 93.45 points
- Stop: 4,051.75 − 93.45 = 3,958.30, down to a The smallest step a price can move. On many stock index futures that’s 0.25 of a point.More in the glossary: 3,958.25
- Target: 4,051.75 + 186.90 = 4,238.65, up to a tick: 4,238.75
- Both match the code.
This trade checks out. A stop 4.25 points higher would have been hit four days sooner.
Your turn
DrillMade-up numbers · code entry 4,059.25 · chart: next bar opened 4,051.75
Trading is risky. You can lose money. Test results are hypothetical, and a test can't tell you what will happen next. This lesson explains how testing works. It isn't advice.