Almost every tool we build to read a chart stays in the world of numbers. This one leaves it. Symbolic Aggregate approXimation (SAX), introduced by Jessica Lin, Eamonn Keogh and colleagues in 2003, takes a window of price and turns it into a short string of letters, something like bddcbbba. Once a piece of the market is a word, you can do to it everything computer science already knows how to do with text: match it, count it, hash it, search it.
This publication puts that to work on one practical question: the market is doing this now; when has it behaved similarly before, and what followed? The indicator encodes the current window, scans history for past windows of similar shape, reads each match's known future, and draws the resulting distribution of outcomes as a forecast fan cone on the chart with a verdict panel reporting the statistics behind it.
The transform itself has three steps, each there for a reason:

The SAX pipeline: z-normalise the window, average it into cells, then map each cell to a letter using Gaussian breakpoints.
What makes SAX search sound rather than merely fast is MINDIST, a distance between two words that provably lower-bounds the true Euclidean distance between the z-normalised series. Because it can only ever understate the real distance, it can be used to discard candidates with no risk of discarding a true match. That is what licenses the two-stage search here: prune with the cheap word distance, then rank the survivors by true Euclidean distance. The published validation harness confirms the pipeline returns exactly the same matches as brute force while skipping much of the work.
Two objects, both rebuilt when a new bar closes.
The fan cone projects the analogs' forward distribution into the future from the last closed bar. A solid line traces the median forward move at each step, and dotted lines above and below trace the 25th and 75th percentiles, so the cone widens as agreement between precedents thins out. The per-step distribution is held in ATR units and multiplied by the current ATR to land on the real price axis, which is what lets precedents from calm and violent regimes contribute to the same cone. The cone is drawn only when the verdict is bullish or bearish, so an absence of cone is itself information rather than a rendering failure.
The verdict panel reports the numbers the cone is hiding:
| Row | What it tells you |
|---|---|
| word | The SAX encoding of the current window, the query the search actually ran on. |
| analogs | How many precedents were found, and their mean match distance. A large count at a poor average distance is a weaker case than a small count of close matches. |
| fwd H | Median forward move over the horizon, in ATR multiples and in percent. |
| band | The 25th to 75th percentile range of those forward moves: the cone's width, as a number. |
| up rate | The share of precedents that moved up at all, and the spread. A median that leans up on a 51% up rate is one precedent's luck, not a lean. |
| VERDICT | Bullish, bearish, no edge, too few analogs, or no data. |
The verdict is deliberately hard to earn. Too few analogs is decided first, then the coin-flip case, and only a sample that clears both conviction bands gets a direction: the median move must exceed the edge threshold in ATR terms, and the up rate must leave the band around 0.5. Fail either and the answer is no edge, whatever the median happens to say.

The forecaster on EURUSD, M30: the fan cone projecting the analogs' median and interquartile band, with the verdict panel reporting the sample behind it.
Honesty by construction
A real SAX library, not an approximation of one
Practical on a live chart
| Setting | Recommended value | Notes |
|---|---|---|
| Symbol | Any liquid instrument | Shape matching is scale free by construction. Development and the screenshot used EURUSD. |
| Timeframe | M30 to H4 | Needs enough history for the precedent set to be meaningful. The window, horizon and history scan are all measured in bars, so they carry over between timeframes unchanged. |
| History | 6000 bars | The default scan depth. More history means more precedents and a firmer distribution, at a linear cost in search time. |
| Panel theme | Match your chart | Dark by default. Switch to light on a white chart or the body text will not read. |
One indicator and two headers. The headers are included as <SAX\...>, so they must sit in their own SAX subfolder.
| File | Role | Description |
|---|---|---|
| Include\SAX\SAXTransform.mqh | The transform | Z-normalisation, PAA, Gaussian breakpoints, word encoding, and the lower-bounding MINDIST. Reusable on any series, with no dependency on charts or trading. |
| Include\SAX\SAXAnalogs.mqh | The search | Two-stage prune-then-rank matching, the no-lookahead guard, ATR-normalised outcomes, the per-step distribution behind the cone, and the verdict classification. |
| Indicators\SAX\SAXAnalog.mq5 | The indicator | Runs the search on each new bar and draws the forecast fan cone and the verdict panel. Plots nothing into buffers; it is all chart objects. |
| Input | Default | What it controls |
|---|---|---|
| InpWinLen | 48 bars | Query window length: how much recent shape has to match for a bar to count as a precedent. |
| InpHorizon | 12 bars | Forecast horizon: how far into each precedent's known future the outcome is measured, and how far the cone extends. |
| InpWordLen, InpAlphabet | 8, 4 | The SAX resolution. Longer words and larger alphabets discriminate more finely and therefore match less often; shorter and coarser gathers more precedents of looser resemblance. |
| InpMaxAnalogs, InpMinAnalogs | 50, 10 | How many closest precedents to keep, and the minimum sample below which the verdict is forced to "too few" regardless of what those few say. |
| InpEdgeATR | 0.25 | Conviction threshold: the median forward move must clear a quarter of an ATR to count as a lean at all. |
| InpMetric | MINDIST | The two-stage prune-then-rank pipeline, which is the production setting. Switch to Euclid for brute force over every candidate: same ranking, no pruning, useful as a correctness and speed baseline. |
| InpATRPeriod | 14 | The ATR used to normalise outcomes and to scale the cone onto the price axis. |
| InpMaxHistory | 6000 bars | How far back to scan for precedents. |
| Colours, corner, theme | Blue / red / gray, upper left, dark | Cone and panel accent colours by verdict, the band line colour, the panel's anchor corner, and the light or dark theme. |
The implementation follows the original SAX work by Jessica Lin, Eamonn Keogh and colleagues, whose SAX page collects the papers.
SAX is not a crystal ball for price, and this tool will report no edge more often than it reports anything else. Its value lies in the rare, well-supported occasions when many genuine precedents lean the same way, and in the discipline of a tool that refuses to pretend otherwise. The same library invites further work: SAX words as categorical features for a machine-learning model, motif and discord discovery for anomaly detection, or a Markov transition model over the word dictionary.
A companion article derives the transform and the lower bound, walks through the search and its guards, and shows the validation harness passing: Symbolic Aggregate Approximation (SAX) in MQL5: Historical Analog Search and Forecasting.
Session Scalping Zones
Session-Based Scalping Indicator for MetaTrader 5. It automatically marks the Asian session high and low, then generates scalping signals at the London open when price breaks or retests those levels. The indicator draws dynamic session ranges, sends alerts and push notifications, and includes optional trend, volume and time filters. Works on M1, M5 and M15 charts for any symbol.
Relative Moving Average EA
An MQL5 implementation of all four cross-strategies from Bloch's Relative Moving Average framework, with his Adaptive Crossover Exit switching rules by volatility regime. Entries and exits are taken in fractile space, so thresholds mean the same thing on every symbol.
Trade Journal and Performance Analytics Dashboard
A lightweight on-chart dashboard that reads your closed trade history and shows win rate, profit factor, streaks, and an equity curve — no strategy inputs, just your own numbers, refreshed automatically.
Sessionvolatilityheatmap
Shows average price range per hour of the trading day as an on-chart heatmap, plus Asian/London/New York session shading behind the candles — so you can see when a symbol actually moves, not just guess.