Trendline Trading: Making a Hand-Drawn Line Into Something You Can Test

9 min readQuantParadox research

A trendline is the most-used tool in discretionary analysis and the least testable, for one reason: two competent analysts looking at the same chart will draw different lines, and both will be defensible.

The short answer

Trendline trading takes entries at a sloped line connecting successive swing points, and because the line's position depends on which points the analyst chose to connect, testing it requires an algorithm that selects those points mechanically without using future information.

What makes a trendline hard to test?

A trendline requires choosing which swing points to connect, and that choice is made by eye with the rest of the chart visible, so the line is fitted to the data it is meant to be tested against.

Watch how a line is normally drawn. The analyst looks at a chart, sees where price has turned, and connects the points that produce a line touched several times. Selecting points because price respected them and then measuring how often price respects the line is circular, and it will produce a strong result on random data.

There is a second problem that compounds the first. Trendlines are frequently redrawn — when price breaks a line, the line is adjusted to a shallower slope and the analysis continues. In retrospect this looks like tracking the trend and in real time it is an unfalsifiable rule, because there is no break that cannot be accommodated by redrawing.

Neither problem exists for horizontal levels, which is why support and resistance is substantially easier to test than trendlines despite the concepts appearing similar.

How do you define a trendline algorithmically?

Define swing points by a mechanical rule, connect them by a stated procedure such as the most recent two confirmed swings in the relevant direction, and require that no intervening price violated the line by more than a normalised tolerance.

Swing detection comes first and carries its own parameter. A fractal definition requiring a fixed number of bars either side is the usual approach, and the bar count decides how many swings exist. Critically, a swing is only confirmed some bars after it occurs, so a line anchored to it did not exist before that confirmation and cannot be treated as available earlier.

The connection rule has to be explicit. Most recent two confirmed swings is the simplest and most defensible. Best fit across the last several swings is also reasonable and produces a different line. Choosing between them by testing both and keeping the better one is a search that has to be disclosed.

The tolerance handles the fact that real price rarely touches a line exactly. Expressed as a multiple of recent average range so it behaves consistently across instruments and regimes, it defines both what counts as a touch and what counts as a violation.

Once these three are fixed, the line is reproducible and the strategy becomes gradeable like any other.

What does a fair trendline test measure?

A fair test enumerates every line the algorithm produces, counts every subsequent touch and every break, and grades outcomes at a fixed horizon — including the lines that were broken immediately and the touches that produced nothing.

The denominator is the entire difficulty. Lines that failed instantly are not memorable and do not get annotated on charts, so informal analysis of this technique is close to guaranteed to be favourable. Mechanical enumeration includes them automatically, which is the main reason to bother with the algorithmic definition.

Two distinct strategies live inside the concept and need separate tests. Trading the touch is a continuation bet that price reacts at the line and resumes. Trading the break is a reversal or momentum bet that price passes through and continues. They can both be real at different horizons, and a single test conflating them reports a muddle.

The comparison worth running is against horizontal levels derived from the same swing points. If a sloped line performs no better than a flat level at the same prior swing, the slope is contributing nothing and a substantially simpler and more reproducible tool is available.

Should you keep drawing trendlines by hand?

Hand-drawn trendlines remain useful for orientation and for framing a discretionary decision, and they are not evidence — the distinction is worth keeping explicit rather than resolved in either direction.

As an orientation tool the technique earns its place. A drawn line is a fast way to see whether successive lows are rising and by how much, and that reading informs a judgement even when it cannot be graded.

The failure mode is treating the drawn line as a rule and then reporting its performance from memory. Memory of trendline outcomes is heavily biased toward the lines that worked, because those are the ones that got a trade and a story attached.

The productive compromise is to keep drawing them for orientation while grading the mechanical version, then check whether your hand-drawn selections differ systematically from the algorithm's. Where they do, that difference is a rule you have not written down — and turning it into one is exactly the process described in our article on practising trading.

How does QuantParadox handle drawn structure?

QuantParadox reads structure, swings and ranges as of the bar being decided rather than with hindsight, which is the requirement that makes any swing-anchored line testable.

The Chart Reader module is built for this class of problem: reading the chart the way a discretionary trader does — structure, swings, ranges, compression, candle shape — while evaluating everything as of that bar and never with information from later. For trendlines specifically, that constraint is what prevents a line from being anchored to a swing before the swing could have been confirmed.

The Strategy Builder also accepts rules drawn on a canvas or described in plain English, which matters for a technique normally held visually rather than as code. That is the format in which a trendline rule actually exists in most traders' heads.

What it will not do is reproduce a line you drew by eye. The algorithmic definition is a different object from your hand-drawn one, and where the two disagree, the honest reading is that the hand-drawn version contains a selection rule that has not yet been stated.

Questions people actually ask

How many touches make a trendline valid?

Two points define a line and a third touch is commonly treated as confirmation, but the count is a parameter rather than a rule of nature. Requiring more touches produces fewer and more selective lines, which raises the apparent hit rate partly because a line that has already held several times is being selected for having held. Whatever count is used must be fixed in advance and applied to every line, including the ones that then failed.

Should trendlines be drawn from wicks or from closes?

Both conventions are in use and they produce different lines, so the choice is another parameter to fix before testing rather than to decide per chart. Wick-based lines respect the full extreme of each swing; close-based lines ignore the extremes and are less affected by single spikes. Testing both and keeping whichever performed better is a search that should be recorded as one.

Is a trendline break a reliable entry signal?

A break is a testable event once the line is defined algorithmically, and it is a different strategy from trading touches of the same line. The main difficulty is that a break is frequently followed by the line being redrawn at a shallower slope in discretionary practice, which means the losing case is often absorbed rather than recorded. A mechanical test has to count each break as an outcome regardless of what would have been redrawn afterwards.

The only backtest that settles it is yours.

Build a strategy from a sentence, paste your own Python, or import your live trade history and have it graded. Five full backtests free, no card, and we'll tell you plainly when the result is indistinguishable from luck.

We publish research and tooling, not trading advice, and we make no claim about future returns. Everything above describes how to test an idea — not a reason to trade one.