Trendline Breakout Backtest: Machine Lines, AI-Drawn Lines and Machine Learning, None Cleared Costs
There is a chart shape most discretionary traders know. Price makes a high, then a lower high. You join the two with a falling line. Price comes back up, touches the line, fails to close above it, and meanwhile the lows stop going down. Then one candle closes through the line and the move runs. It is a shape I have traded myself, and it often feels like it works. On Monday evening, 23 November, I set out to measure it properly, and by the end of the night I had closed the question: on my data and my costs, I could not find a version of it that pays.
This entry is the record of that night: the rules, the different ways I tried to draw the line, the five improvement rounds, the check that ended them, and what is left standing. Everything is research on historical one-minute data. Nothing here is a product or runs on live money.
Why counting by eye flatters this pattern
Before writing a line of code I listed the four ways a trader counting these setups by eye is likely to overrate them, because the test had to remove all four.
First, hindsight lines. After a breakout it is easy to draw the line that "worked". So peaks and troughs were chosen by a zigzag rule (a peak is confirmed once price falls k times the ATR below it), and the line could only use peaks already confirmed at that moment. Second, we remember the winners. So every shape that met the rules was counted, including the ones that broke and failed at once, and each line could be traded only once, on its first break. Third, the entry price. A break was defined only by an hourly close above the line, and the entry was the first one-minute open of the next hour. Fourth, no baseline. "It broke out and went up" is true of almost anything in a rising market, so every result was compared with 2,000 placebo versions that keep each trade's entry time, stop distance, target and time stop, and only randomise its direction. I described that placebo, and a hole I found in it, in last week's entry.
The exits were fixed before any profit figure was seen: a stop below the lowest low since the second peak minus 0.1 ATR, clamped between 0.5 and 4 ATR; a target equal to the height of the shape; and a time stop equal to the shape's length in bars, between 12 and 120 hours (all mirrored for sells). One R is the stop distance. Costs come from a model built on my own recorded fills (spread, slippage and overnight financing), not a fixed figure.
The instruments were gold, US500, USDJPY and EURUSD, chosen before testing because they are the most watched, which is the whole mechanism behind the idea: many people see the same line, so stops and entry orders cluster just beyond it. The data is split by entry time. The build half (2015 to 2020) can be looked at freely. The score half (2021 to October 2026) counts as a trial each time it is read, and is read only by a row that passes four gates on the build half: an entry check (enough trades per year, holding time, cost per R and overlap with earlier strategies), above the placebo median before costs, a power test, and an edge larger than the cost per trade.
One correction happened before any result. I drew eight of the machine's shapes and looked at them. Two of the eight joined two adjacent peaks a few bars apart: a steep line no person would draw. I added a rule that the two peaks must be at least six bars apart, and only then looked at profit.
Round one: four rules on the hourly chart
| Rule (H1, build half 2015-2020) | Trades | Before costs | Placebo median | Rank vs placebo (top %) | After costs |
|---|---|---|---|---|---|
| T1: two lower highs + rising lows | 2,305 | +0.010R | +0.004R | 38.6% | -0.075R |
| T2: touch, then break (my own shape) | 1,350 | +0.007R | +0.001R | 42.4% | -0.078R |
| T3: T1 without the rising-lows rule | 3,796 | +0.027R | +0.004R | 9.1% | -0.049R |
| T4: T2 on larger swings (zigzag 3.0 ATR) | 530 | +0.130R | -0.015R | 0.15% | +0.092R |
| Comparison: horizontal break of the second peak | 1,925 | +0.000R | -0.002R | 45.1% | -0.059R |
The rank column reads like this: 50% means the rule did no better than a coin deciding the direction, and smaller is better.
The shape I trade myself, T2, was indistinguishable from random direction even before costs. The diagonal line added nothing over a horizontal line at the same peak. Only T4, the same shape on bigger swings, passed all four gates, and only just: the power test needed +0.097 and it showed +0.097. Its years were also a warning I wrote down at the time. In the build half it was positive from 2015 to 2018 and negative in 2019 (-0.076R) and 2020 (-0.177R).
So T4 went to the score half, with a written plan first. On 539 trades from 2021 to October 2026 it made +0.016R per trade before costs against a placebo median of +0.011R, which ranked it at 45.2%, in the middle of the placebos. After costs it was -0.0003R. Even that near-zero result depended on a few large runs: without the top 5% of trades the after-cost average was -0.208R. Gold was positive in both halves, but deciding to keep "gold only" after seeing that would be choosing on the result, and my rules forbid it.
Was it the way I drew the line?
The obvious objection is that a zigzag draws worse lines than a person. So I compared five ways of drawing the line: the original zigzag, the larger-swing zigzag from T4, swing points defined as the highest bar within five bars either side, lines that even the wicks had not crossed, and lines with a third touch before the break. Each was run on M15, H1, H4 and D1, which makes 20 cells.
Two of the cells repeat round one (T2 and T4 on H1), and both reproduced it exactly, which confirmed that the rebuilt pipeline was right. Of the 18 new cells, none reached the top 5% of its placebos; with no edge anywhere, about one would be expected by chance. None passed the four gates, so the score half was not read. Three H4 cells were positive after costs, but the placebo versions of the same trades also won (placebo medians +0.04 to +0.07R). Holding for days in rising gold and a rising index earns that much regardless of the line. Three more cells were positive after costs, but on only 6 to 49 trades, too few to pass the entry check. M15 lost to costs everywhere, D1 had too few trades, and a clean third touch turned out to be rare (49 cases on H1 in six years and four instruments).
Letting a vision model draw the lines
Next I removed my rules from the drawing altogether. I gave 100 chart images (the four instruments on H1 and H4, 2016 to mid-2020, with dates and prices hidden) to five instances of a vision-capable language model, 20 charts each. Each instance drew at most one line per chart and said whether it expected a breakout, a bounce, or either. It was not told any earlier result. Together they drew 78 lines and declined 22 charts.
Its lines were mostly different from the machine's: on the 74 charts where both drew a line, only 8 sat on the same peaks. The results were not different. These trades were scored with a simpler exit fixed in advance (stop 1 ATR, target 2 ATR, at most 24 bars), so the R figures are not comparable with the tables above. The 59 trades from the lines it had marked "breakout" or "either" made -0.145R per trade before costs against a placebo median of -0.147R (top 47.5%), and -0.256R after costs. On the same charts the machine's lines made -0.178R after costs. A different choice of line gave the same answer, which suggests the problem is not which line is chosen.
Letting a model choose among the lines
The last approach was to keep all 14,718 candidate breaks from four drawing methods on M15, H1 and H4, and let a gradient-boosted model (LightGBM, small trees) pick the top 30% by its prediction, using features known at the breakout close: timeframe, instrument, drawing method, slope, spacing, shape height, break size, candle body, volatility, prior trend, time of day, day of week and stop width. It was trained walk-forward by year, predicting 2017 to 2020 one year at a time.
The selected group, 2,931 trades, made +0.060R before costs against a placebo median of +0.024R (top 6.85%), and -0.142R after costs. The model's predictions barely ranked trades at all: rank correlation with the real outcome was between -0.014 and +0.070 across the four years. The selection only helped in 2017 and 2018. The model's most-used feature was stop width, which is really a cost feature: narrow stops make the cost per R larger. I split the candidates into 71 bands across the features, and none was positive after costs.
Five improvement rounds, and the check that stopped them
I then ran five rounds, each adding one new ingredient rather than retuning numbers, with one score to beat: d2, the edge over the placebo median divided by the cost per trade. Above 1 means the edge pays for the costs. A stopping rule was written before the first round: if the best d2 after five rounds is below 0.5, close the direction.
| Round | Ingredient added | d2 | After costs | Kept? |
|---|---|---|---|---|
| Start | Model selection as above | 0.18 | -0.142R | - |
| 1 | Train on after-cost R instead of before-cost R | 0.33 | -0.067R | yes |
| 2 | Higher-timeframe trend, nearby horizontal level, number of touches, range contraction before the break | 0.50 | -0.047R | yes |
| 3 | Enter on a pullback limit order at the line instead of at market | 0.20 | -0.081R | no |
| 4 | Add higher-timeframe lines broken on the lower timeframe | 0.36 | -0.058R | no |
| 5 | Three features suggested by the vision model after studying 60 winners and losers (judged on 2019-2020 only) | -0.23 (baseline on the same years 0.05) | -0.146R | no |
Round 2 reached 0.501, just over the line. Round 1 helped mainly by choosing shapes with wider stops, so cost per trade fell to 0.107R (0.169R across all candidates); the edge over the placebo stayed small. Round 3 said something useful: the small edge is in the momentum straight after the break, and waiting for a pullback loses it. Round 4 found something more important. Adding just 3% more candidates changed which of the original candidates the model selected, and the placebo rank of the round 2 selection moved from 0.60% to 5.2%. That meant 0.50 might be one lucky draw.
So before deciding, I wrote down a check and its rule: drop a random 3% of candidates, rerun the round 2 model, ten times; if the median d2 is below 0.5, apply the stop. The ten d2 values ranged from 0.20 to 0.69 with a median of 0.39. All ten were above the placebo median before costs. Only two of ten passed the power test. All ten were negative after costs, between -0.045R and -0.081R per trade. The stop applied, and the direction is closed.
What is left standing
I do not think the right summary is "trendlines are noise". Before costs, the better selections were consistently a little above random direction. The edge was real enough to show up ten times out of ten, but it was about 40% of a cost of roughly 0.106R per trade, and 2019 never worked: in rounds 1 and 2 the 2019 selection did worse than 98% and 90% of its placebos. Most of the improvement I managed came from picking shapes that are cheap to trade and breaks that coincide with a horizontal level or follow a contraction, not from the diagonal line.
The limits of the claim matter as much as the claim. This is four instruments, four timeframes (most of the model's candidates were on M15), one cost model built on one broker's fills, and one set of exits. A trader with lower costs would see different numbers. Placebo ranks in the model rounds are, if anything, flattering, because many selected trades overlapped in time while each placebo direction was drawn independently. And there is one thing I did not measure at all: a person drawing the line in real time, without hindsight. My own feeling that this shape "often works" cannot be separated from remembering the lines that worked. The only fair test of that is a log of lines recorded before the break, with the chart saved at that moment. I will reopen the question only when there are 30 to 50 such entries, and I will not rerun the rule variants above with different numbers.
Before the first test I wrote down my prediction: about a 70% chance that the shape would be indistinguishable from random direction, or distinguishable but not enough to pay for costs. That is roughly what happened, but the night was worth it for the detail: where the small edge sits (right after the break), what kills it (cost per R), and how easily a model's good-looking score turns out to depend on which 3% of the data it saw.
Where a small edge did show up, in the model rounds, it was the cost per trade that decided the result. If you want to see what your own broker charges on each fill rather than assume a fixed spread, Execution Caliper FREE is the tool I made for that kind of measurement.


