AI trading
AI chart pattern detection: how it works (and what 'AI' means)
By the PatternX team · Published
Short answer
AI chart pattern detection usually means one of three things: geometric rules that find shapes in price data, machine-learning models fitted to labelled charts or price sequences, or a hybrid in which rules find candidates and a scoring layer filters them. Each can fail through false positives, lookahead, repainting or overfitting, so ask a vendor which approach it uses and how it was tested.
What "AI" can mean in pattern detection
There is no standard definition. When a product says it uses AI to find chart patterns, the detection step is usually built in one of three ways:
- Geometric rules. Code finds swing highs and lows, tests them against tolerances and checks a breakout rule. The same candles always give the same answer.
- Machine-learning models. A model learns from labelled examples, such as chart images or windows of price data that people tagged as "head and shoulders", "flag" or "no pattern", and outputs a label or a probability for new data.
- Hybrids. Rules find candidate patterns; a scoring layer or model then decides which candidates are worth showing, based on context such as trend, volume and volatility.
Some products use "AI" for all three. Others detect with rules and attach a language model that describes the result. None of these is wrong in itself, but they behave very differently, so it is worth knowing which one you are relying on.
Approach 1: geometric rules
Rule-based detectors translate a pattern's textbook description into measurable conditions: two lows within a set percentage of each other, a neckline a minimum distance above them, a close through that line. The mechanics (swing points, tolerances, line fitting, lookback windows) are covered step by step in automated chart pattern detection.
- Strengths: every detection traces back to a rule; results are reproducible, so a backtest tests the same logic you trade; it is fast enough to run across many symbols.
- Weaknesses: tolerances are blunt. Too tight and the detector misses shapes a trader would accept; too loose and it flags coincidences. It also sees only the bars inside its window.
Approach 2: machine learning
Image recognition
One family renders charts as pictures and fits an image classifier to examples labelled by people. The appeal is that it reads a chart roughly the way a trader does. The problems are practical. Labels are subjective: two analysts often disagree on whether a shape qualifies. Rendering choices such as zoom, scale and timeframe change the picture the model sees. And a model can learn artefacts of how its training charts were drawn rather than the pattern itself.
Sequence and feature models
Another family feeds windows of normalised price and volume, or hand-built features such as slopes and distances between swings, into a classifier. That avoids image artefacts but keeps the other problems: it needs many labelled examples, genuine patterns are rare compared with "no pattern" windows, and the reasons behind any single detection are hard to read.
Either way, a learned detector outputs how closely a window resembles its training examples. That is not the probability that a trade taken on it will work.
Approach 3: hybrids
Hybrids keep detection auditable while adding judgement. Rules decide whether a pattern exists; a separate layer rates the context around it, such as trend, volume, volatility and liquidity, and filters or re-weights the result. The split is the advantage: you can verify the geometry on the chart and read the context scores separately. The risk is that a context layer can still be overfitted if its weights were tuned on the same history used to judge it.
Failure modes to understand
| Failure mode | What it looks like | Most exposed | How to check |
|---|---|---|---|
| False positives | Patterns flagged in noise, especially on low timeframes | Loose rules; models with low thresholds | Open twenty detections and judge each one by eye |
| Lookahead bias | A backtest uses information that wasn't available when the signal fired | Any approach, usually in the testing code | Ask whether each historical signal used only bars that existed at that moment |
| Repainting | A signal appears, moves or vanishes on past bars after the fact | Detectors that recompute pivots on every new bar | Screenshot live signals and compare them a week later |
| Pivot lag | Swing points confirmed only several bars after they happen | Every swing-based detector | Ask how many bars a pivot needs on each side |
| Overfitting | Strong historical results that fade in live trading | Learned models and heavily tuned rules | Look for out-of-sample results and trade counts |
Lookahead and repainting are related. A swing high can only be confirmed once later bars have failed to exceed it, so a tool that marks pivots instantly is either guessing or will redraw them. Honest systems accept the lag. A chart that shows only the redrawn version makes past signals look cleaner than anything you could have traded.
Questions to ask a vendor
- Is detection rule-based, learned, or both, and which part is called "AI"?
- Can I see the rules, or at least the tolerances and lookback for each pattern?
- Do signals ever change or disappear on past bars?
- Does a signal fire while the current bar is still forming, or only after it completes?
- Were backtests run on data the system wasn't tuned on, and do they include fees and slippage?
- If a model is involved, what was it fitted to, and how often is it retrained?
- Does a language model appear anywhere, and can it influence a trade?
- What happens after a signal if the pattern fails?
A vendor with a solid product can answer each of these in a sentence or two.
How PatternX does it
PatternX uses the hybrid approach, with detection that is entirely rule-based:
- Twenty deterministic detectors run on every scan, one for each pattern in the pattern library. Each reads a fixed trailing window, from about 41 bars for flags and pennants to 110 for triple tops and bottoms, returns at most one match, and only reports a breakout on the latest bar.
- Universal filters apply to every pattern: the breakout bar must close in the trade's direction on volume at least 1.2 times its 20-bar average, and volatility, liquidity, spread and order-book balance must pass fixed thresholds.
- The PatternX Score rates the setup from 0 to 100 with 13 fixed weights. Pattern geometry and a fixed reliability prior make up 24% of the weight; market context makes up the rest. See the PatternX Score.
- The optional context layer, PatternX AI on Pro and Elite, scores eight context factors and can veto the setup or re-weight its confidence. It never detects or invents patterns and doesn't change stops, targets or position size: detection is identical in Classic and AI modes.
What PatternX doesn't claim: there is no image recognition and no learned model anywhere in detection. Swing points need two or three bars on each side, so pivots are confirmed late. The latest bar may still be forming, so a breakout can fail before that bar completes, and there is no separate invalidation step after a signal: if the pattern fails, the stop-loss is the exit. Formations larger than a detector's window aren't seen at all. The details are in pattern detection and limitations.
Frequently asked questions
Can AI recognise chart patterns better than a person?
Software is faster and more consistent than a person scanning charts, but it can't be more correct than the rules or labelled examples behind it. Compare a sample of its detections with your own reading before relying on it.
What is repainting in a pattern indicator?
Repainting is when a signal or drawing on past bars changes after the fact, usually because the tool recalculates swing points as new bars arrive. It makes historical charts look cleaner than what you could have traded live.
Does PatternX use image recognition to find patterns?
No. PatternX detects patterns with 20 rule-based detectors that work on candle data: open, high, low, close and volume. PatternX AI only evaluates setups after they have been detected.
Why do pattern scanners flag so many false patterns?
Usually because tolerances are loose, the timeframe is short and noisy, or nothing confirms the breakout. Tighter rules and confirmation filters cut false positives, at the cost of skipping some valid setups.
Is a pattern's confidence score the chance that the trade will work?
Not unless the vendor shows how it was measured. A model's output usually reflects similarity to its training examples, and a scoring formula rates conditions. In PatternX, the displayed probability is a heuristic derived from confidence, not a measured win probability.