An AI agent analysing a crypto chart is doing one of two very different things, and the difference decides what its output is worth.
In the first design, a language model is shown a chart — as an image, or as a table of prices — and asked what it sees. In the second, a deterministic engine computes the indicators, finds the turning points, matches the geometry and produces the reading, and a language model is used only to put that finished reading into sentences.
Both get described as "AI chart analysis". Only one of them can tell you the same thing twice about the same chart. This is an account of how the second kind works, stage by stage, using the engine behind this site as the worked example.
The six stages
| Stage | What happens | Model involved |
|---|---|---|
| 1. Fetch candles | Pull the OHLCV series for one market and timeframe from a public exchange API | No |
| 2. Compute indicators | Moving averages, ADX, RSI, MACD, ATR, Bollinger, OBV, VWAP, Ichimoku, volume profile | No |
| 3. Detect swings | Reduce the series to alternating high/low pivots | No |
| 4. Match formations | Test the pivot sequence against eighteen geometric definitions | No |
| 5. Score | Combine five weighted lanes into one composite reading | No |
| 6. Narrate | Turn the finished numbers into readable prose | Yes |
Five of the six stages are arithmetic. The model enters at the last one, after every number that will appear on screen has already been fixed.
That ordering is the whole architecture. Everything below is an elaboration of why each stage is built the way it is, and what it costs when a stage is replaced by a model instead.
Stage 1 — Candles, and where they come from
The input is the OHLCV series: for each bar, the open, high, low, close and volume. Nothing else. No news feed, no social sentiment, no order-book depth.
The source is a public exchange REST endpoint, with a second exchange as fallback, and the set of markets that can be requested is a fixed whitelist rather than anything a URL can widen. A minimum of sixty bars is required before analysis will run at all, because every indicator below has a warm-up period and a reading computed on a half-populated moving average is worse than no reading.
This stage is boring, and it is the stage most worth being boring. A model asked to read a chart image has already lost this data — it is inferring prices from pixels, and it cannot recover the exact close of bar 47.
Stage 2 — Indicators
Standard definitions, computed directly from the series: moving averages and their structure, ADX with directional indicators, RSI, MACD, Stochastic, ATR, Bollinger bands and squeeze state, OBV, rolling VWAP, Ichimoku, and a volume profile over the last 120 bars.
There is one property here worth stating because it is easy to skip: the implementations are cross-checked against reference implementations rather than trusted because they look right. An RSI that is subtly wrong — the wrong smoothing, an off-by-one in the seed period — produces plausible numbers forever and silently corrupts everything downstream. Verification is what separates "we computed RSI" from "we computed something and called it RSI".
Stage 3 — Swings, not bars
Formations are matched against swing pivots, never against raw bars. This single decision removes an entire class of false positives: one spiky candle cannot create a pattern, because one candle cannot create a pivot.
Pivots come from a ZigZag walk. A candidate extreme is only committed once price reverses away from it by more than 2.5 × ATR(14), floored at 0.8% of price. Two consequences follow:
- The threshold is volatility-relative. A fixed percentage would be far too loose on a quiet week for BTC and far too tight on a $0.30 altcoin. Scaling by ATR makes one setting behave sensibly across the whole whitelist.
- Detection cannot start until ATR is defined. Before that the threshold would collapse toward zero, and a single wide bar could mint a pivot out of nothing.
Pivots strictly alternate high, low, high, low. And the most recent pivot is marked provisional — price has not yet retraced far enough to prove it. A provisional pivot may occupy only the last position of a formation, never the middle, so a shape cannot be built on a turning point that has not happened yet and then evaporate on the next bar.
That provisional rule is one of the clearest places where a deterministic engine differs from a model reading a picture. A model looking at a chart image has no concept of a pivot that is not yet confirmed. It sees a shape, and shapes in the rightmost part of a chart are exactly where wishful pattern-matching lives.
Stage 4 — Eighteen formations, defined geometrically
The recognised set splits into reversal and continuation shapes:
Reversal — double top and bottom, triple top and bottom, head and shoulders and its inverse, rounding bottom, cup with handle, rising and falling wedge.
Continuation — ascending, descending and symmetrical triangle, rectangle, bull and bear flag, bull and bear pennant.
Each is a set of geometric conditions on the pivot sequence. Four of those conditions are worth spelling out, because each one is a place where the obvious implementation is wrong.
Matching is scaled by formation height, not percent of price
"Two peaks within 3% of each other" sounds like a reasonable definition of a double top. It is a strong match on a formation spanning 20% of price, and completely meaningless on one spanning 4% — but a percent-of-price test scores them identically.
Peaks are instead required to agree to within roughly a fifth of the formation's own height. The test scales with the thing being measured.
Trendline quality uses worst-case residual, not r²
The intuitive quality measure for a trendline is r², the share of variance the line explains. It is the wrong measure here, and wrong in a way that specifically destroys the most valuable detections.
A horizontal trendline has almost no variance to explain. The flat resistance of a textbook ascending triangle — the single most recognisable continuation shape there is — scores r² near zero. Gating on r² rejects it.
The engine instead requires every touch to sit within 18% of the formation's height of its line. That behaves correctly for flat and sloping boundaries alike.
A rounded base has to beat a V
A parabola fits a sharp V-shaped reversal well enough (r² around 0.94) that no r² threshold can separate a rounding bottom from a V. So both models are fitted — a parabola, and two straight legs split at the low — and the shape is only called rounded if the parabola actually wins the comparison. A minimum sagitta, meaning how far the base sags below the chord joining its rims, additionally rules out the slow monotonic drifts that otherwise dominate the false positives.
Reversals must reverse something, at an extreme
A "double top" in the middle of a range is just three pivots in a row. Reversal formations are required both to follow a move in the opposing direction and to sit near an extreme of the preceding chart. Without that condition, a sideways market generates reversal patterns endlessly, all of them meaningless.
Confidence, and the threshold that decides what gets reported
Every detection carries a confidence between 0 and 1. It is a weighted mean of named components, and the components travel with the pattern and are rendered on screen, so the number is never a bare assertion.
| Component | What it measures |
|---|---|
| similarity | How closely the repeated tests match each other |
| magnitude | Formation height, in ATR |
| symmetry | Balance of leg durations |
| volume | Whether volume behaved as the textbook expects |
| prior_trend | Whether there was a move available to reverse |
| extremity | Whether the formation sits at an extreme of the chart |
| completion | Whether the decision line has actually broken |
| containment | Whether price respected the boundaries |
| upper_fit / lower_fit | How tightly the touches hug their trendline |
| roundness / sagitta | Curvature evidence, for rounded bases |
The default reporting threshold is 0.72, and it was chosen by measurement rather than taste. Ten textbook fixtures and forty independent 400-bar random walks were run through the detectors:
| Textbook fixtures | Random walks | |
|---|---|---|
| Median confidence | ≈ 0.88 | ≈ 0.74 |
| Weakest / strongest | ≈ 0.79 (min) | ≈ 0.80 (max) |
| Series producing any formation | 10 / 10 | 14 / 40 |
Read the last column first. Fourteen out of forty pure random walks produced a formation the detector was willing to name. Pattern recognition finds patterns in noise, because that is what pattern recognition does.
Now read the tails. The best shape found in noise scores about as highly as the weakest genuine textbook fixture. The two populations separate cleanly at the median and overlap at the edges, and no threshold can fix that, because it is a real property of the problem rather than a bug. Genuinely ambiguous formations exist; suppressing them entirely would discard real ones alongside the noise.
The design choice that follows is to report ambiguous formations and score them low, rather than to hide them. 0.72 sits below the signal floor so imperfect real formations still surface, while the bulk of noise falls away. Both properties are pinned by tests — at most 40% of random walks may yield anything, and the median textbook confidence must stay above the 90th percentile of noise — so the threshold cannot quietly drift.
Silence is an answer, and a common one
Returning nothing is a valid outcome. On random-walk data the detectors stay silent on most series, and on real charts they are silent most of the time too.
This is the single most important behaviour to look for in any automated chart tool, and the hardest one to sell. A product that answers "no textbook formation is present" on a normal day is less engaging than one that always finds something. It is also the only kind that can be trusted on the day it does find something.
When several readings are valid at once
The same price action often supports more than one honest reading. A chart with flat resistance and rising lows genuinely contains a double top inside it.
Overlapping detections compete, and the winner is decided by confidence plus a small credit for how many pivots the reading accounts for — so "ascending triangle", which explains six pivots, beats "double top", which explains three, over the same stretch. The credit affects ordering only. The reported confidence is never altered by it, so the number displayed always matches its own component breakdown.
Stage 5 — Scoring, with the weights published
Five lanes are computed independently and combined into one composite reading.
| Lane | Weight | What feeds it |
|---|---|---|
| Trend | 0.30 | Moving-average structure, ADX with directional indicators, Ichimoku position |
| Momentum | 0.25 | RSI, MACD, Stochastic |
| Pattern | 0.20 | The formation from stage 4, if any |
| Volume | 0.15 | OBV, position relative to VWAP, volume profile |
| Volatility | 0.10 | Position inside the Bollinger envelope, squeeze regime |
The weights are exported and rendered next to the score rather than kept internal. A single number labelled "trend score" is only defensible if you can see exactly what produced it — and publishing the table has a second effect, which is that changing a weight becomes a visible product change rather than a silent tuning tweak.
The ordering has reasons. Trend dominates because the composite is explicitly a trend score. Momentum is the strongest independent confirmation of trend. Pattern is high-signal when a formation exists but is frequently absent, and it contributes a neutral 50 when nothing is detected — a larger weight would simply drag every score toward the middle on the majority of days when there is no formation at all. Volume corroborates price rather than leading it. Volatility is the least directional of the five and is deliberately the smallest term.
If a lane is missing, the composite is normalised by the weights actually present, so an absent lane rescales the remainder instead of quietly pulling the result toward zero.
Stage 6 — Where the language model finally appears
Everything above produced numbers. The model's job is to turn them into sentences, and nothing else.
It cannot change a level. It cannot rename a formation. It cannot invent a component score. It receives a finished structure and writes prose about it, and its output is validated against that structure before display.
The failure ladder is worth describing, because it says what the model is really for. If the model returns something that fails validation, it is retried once. If it fails again, the system falls back to a deterministic template sentence. If that is unavailable, the narration is simply absent — and the analysis still renders, because the analysis was never the model's to produce.
A component whose failure degrades the prose but not the numbers is a component that was never load-bearing.
What the two architectures can and cannot claim
| Deterministic engine, model narrates | Model reads the chart | |
|---|---|---|
| Same chart, same answer | Yes | No |
| Published hit rates are reproducible | Yes | Not definable |
| Exact prices available | Yes | Inferred, if reading an image |
| Can explain why a formation scored what it did | Yes, per component | Post-hoc explanation only |
| Handles a market it has never seen | Yes, same geometry | Yes, unpredictably |
| Can say "nothing is here" reliably | Yes, by threshold | Rarely, in practice |
| Recognises shapes nobody has defined | No | Sometimes |
The last row is a genuine advantage of the model-first design and should not be waved away. A deterministic engine can only find the eighteen shapes somebody sat down and encoded. It will never notice the nineteenth.
But look at the second row, because it is the one that matters for anyone trying to evaluate these tools. A hit rate — the share of formations that resolved in their textbook direction — requires a fixed detection procedure to even be defined. If the procedure is "ask a model", there is no stable population of detections to measure, and any percentage published about it is unfalsifiable. That is not a criticism of the model's ability. It is a structural fact about what can be measured.
What this architecture does not do
Stated plainly:
- It does not forecast. It names what is on the chart now, and attaches what historically followed the same shape. Neither is a prediction, and the historical record is thin enough that it should not be read as one.
- It sees price and volume only. No news, no funding rates, no on-chain flows, no positioning. A chart-shaped answer is a chart-shaped answer.
- It cannot tell you whether a formation matters. Statistical significance is not something geometry can establish, which is why the sample counts are published separately.
- Eighteen shapes is a closed set. Anything outside it is invisible to the engine, however obvious it may be to a person.
- Determinism is not accuracy. Being consistently wrong is also consistent. Reproducibility is what makes a claim checkable; it is not what makes it correct.
Five questions to ask of any AI chart tool
- Which stage is the model in? If it produces the numbers, reproducibility is gone.
- What happens on a chart with no formation? A tool that always finds something has no threshold.
- Is the confidence broken down? A bare score with no components is an assertion.
- Are the scoring weights published? If not, the score can be retuned without anyone noticing.
- Can it show the hit rate, with sample counts and detection thresholds? If those three do not appear together, the rate cannot be evaluated.
In short
- "AI chart analysis" describes two architectures with opposite properties. Which stage the model occupies is the question that separates them.
- In this engine, five of six stages are deterministic arithmetic. The model writes prose about a finished result and can alter nothing.
- Formations are matched on swing pivots, not bars, using thresholds scaled to volatility rather than to a fixed percentage.
- The 0.72 confidence threshold was set by measuring textbook fixtures against random walks — where 14 of 40 pure noise series still produced a nameable formation.
- Silence is a normal output and a necessary one.
- Determinism buys reproducibility, not correctness. It is what makes a published hit rate checkable at all.