Structural Break Scanner: Setup, Parameters, and Threshold Calibration
This is the user manual for the Structural Break Scanner. It covers installation, how to read the panel, what each of the five statistical tests measures, how to calibrate thresholds for your own instruments, and a complete reference for every input parameter.
Contents
- What the scanner does
- Installation
- Quick start
- Reading the panel: regime mode
- Reading the panel: evidence mode
- The five tests
- Understanding the confluence count
- Half-life
- Threshold calibration
- Alerts
- Parameter reference
- Interpreting the output
- Relationship to my published articles
- Verification
- Frequently asked questions
- Does it place trades?
- Can I use it to generate entry signals?
- The panel says EXPLOSIVE but price is falling. Is that wrong?
- Does it repaint?
- Everything says RANDOM. Is it broken?
- Which timeframe should I use?
- How many symbols can it scan?
- Does it work on indices, metals, crypto, and stocks?
- Do I have to calibrate before using it?
- How often should I recalibrate?
- Can I run several copies on different timeframes at once?
- Does it work in the Strategy Tester?
- Will it run on a VPS?
- How is this different from the free code in your articles?
- What does 2/4 in the EVID column mean?
- Do I get the source code?
- Troubleshooting
- Support
What the scanner does
The scanner classifies each symbol on your watch list into one of three regimes and reports how much statistical evidence supports that classification.
| Regime | Meaning | What the panel adds |
|---|---|---|
| STEADY | Mean-reverting. Deviations tend to be corrected. | Estimated half-life in bars |
| RANDOM | Behaves like a random walk. No exploitable structure. | Current test statistic |
| EXPLOSIVE | Trending or bubble-like. Deviations tend to grow. | Current test statistic |
The classification is a statistical statement about the recent behavior of the price series. It is not a trade signal, and it says nothing about direction.
Installation
The scanner installs the way any Market product does. After purchase or rental it appears in the Navigator window of your terminal, under Market, and you drag it onto a chart. There is nothing to copy manually, no supporting files to place, and no separate script to run: everything, including threshold calibration, is contained in the indicator itself.
Quick start
Drag the scanner onto any chart with default settings. It will scan the eight major currency pairs on the chart timeframe and populate the panel within a few refresh cycles. Rows showing loading are waiting on history to download; they resolve on a later refresh.
If your broker uses symbol suffixes, set the Broker suffix input to match. A list written as EURUSD then resolves to EURUSD.m, EURUSD_i, or whatever your account uses. Symbols that cannot be resolved are reported in the Experts journal and skipped rather than failing silently.
Reading the panel: regime mode
Regime mode is the default and shows six columns.
| Column | Contents |
|---|---|
| SYMBOL | Click to switch the chart to that symbol |
| REGIME | STEADY, RANDOM, or EXPLOSIVE, color-coded |
| EVID | Confluence count, such as 3/4 |
| DETAIL | Half-life in bars when steady, otherwise the ADF statistic |
| AGE | Refresh cycles since the last regime change |
| BREAK | Direction of an active CUSUM break, if any |
Click any column header to sort by it, and click the same header again to reverse the direction. The active sort column is marked with a caret. The default sort places explosive symbols first, so on a long watch list the symbols worth attention stay at the top and the row cap hides the rest without losing anything.
The Evidence button switches modes. The Hide button collapses the panel to its title bar when you need the chart clear.
Reading the panel: evidence mode
Evidence mode replaces the interpretation with the raw statistics: the full-window ADF, the SADF supremum, the CUSUM statistic with its critical boundary, the Chow supremum, and both martingale statistics. This is where you verify that a classification is supported rather than taking it on trust.
The five tests
Each test answers a different question. They are drawn from the structural break literature and are discussed together in Lopez de Prado, Advances in Financial Machine Learning (2018), chapter 17.
Full-window ADF (the regime axis)
The Augmented Dickey-Fuller regression over the whole evaluation window. Strongly negative values indicate mean reversion; positive values indicate explosive behavior. This single statistic determines the regime label.
It is deliberately not the SADF supremum. SADF maximizes over many candidate starting points and therefore runs high by construction, which is exactly what makes it a good detector and a poor classifier. Classifying on a supremum would label almost every symbol explosive.
Chu-Stinchcombe-White CUSUM
Compares the current log price against every earlier reference point in the window, standardized by return volatility and elapsed span, and takes the supremum against a boundary that grows with the span. It detects a sustained departure from an earlier price level, and reports a direction. Developed for financial series by Homm and Breitung (2012).
Chow-Type Dickey-Fuller
Tests for a break at an unknown date by trying every admissible break point and keeping the strongest. Where CUSUM asks whether the level departed, this asks when the behavior changed. Following Chow (1960) and Andrews (1993).
Supremum ADF
The ADF statistic maximized over backward-expanding start points within the window. It answers whether any recent sub-window shows explosive behavior, which is a more sensitive question than whether the window as a whole does. From Phillips, Wu and Yu (2011) and Phillips, Shi and Yu (2015).
Sub-martingale and super-martingale tests
Two alternative trajectory shapes for explosive growth: exponential and power-law. They fit log price against time and against log time respectively, and report the significance of the trend coefficient. They count as a single line of evidence, because they are competing descriptions of the same phenomenon rather than independent confirmations.
Understanding the confluence count
The EVID column shows how many of the four secondary tests corroborate the classification, out of how many were available.
This is kept separate from the regime label on purpose. Two symbols can both read EXPLOSIVE with confluence of 1/4 and 4/4, and that difference is real information. A single blended score would hide it. Read the count as follows:
- 0/4 or 1/4. The classification rests on the ADF statistic alone. Treat it as provisional.
- 2/4. Independent corroboration. This is the default gate for alerts.
- 3/4 or 4/4. Multiple tests agree using different mathematics. The strongest reading the scanner produces.
One caveat worth stating plainly: several of these tests take a supremum over many candidate break points, which raises the effective false-positive rate above the nominal significance level. Read confluence as strength of evidence, not as a calibrated probability.
Half-life
When a symbol classifies as STEADY, the DETAIL column shows the estimated mean-reversion half-life in bars, derived from the AR(1) coefficient of the same regression that produced the regime label.
This converts an abstract label into something you can act on. A half-life of 40 bars on H1 means a reversion has a defined horizon of under two days. A half-life of 900 bars on the same timeframe means the reversion is real but far too slow to trade around. The panel shows hl n/a when the coefficient falls outside the range where a half-life is defined.
Threshold calibration
Regime thresholds are not universal. A statistic that indicates explosive behavior on one instrument can be unremarkable on another, because the distribution of the test statistic depends on the volatility structure of the series.
The scanner ships with defaults grounded in published critical values. The steady threshold of -2.86 is the standard five percent Dickey-Fuller critical value with an intercept. These work, but calibrating to your own instruments works better, and the scanner does it for you.
Running the calibration
Press the Calibrate button in the panel title bar. The scanner begins sweeping history for each symbol on your list, and the status line reports which symbol it is working on and the percentage complete.
The sweep runs in the background, a small slice of work per refresh cycle. This matters: all indicators on one symbol share a single execution thread, so a sweep of thousands of regressions performed in one pass would freeze every chart on that symbol. Doing the work in bounded slices keeps the terminal responsive throughout. The trade-off is that the sweep takes longer in wall-clock terms than it would if it monopolized the thread, typically a few minutes for eight symbols at default settings.
Normal scanning pauses while calibration runs, and resumes automatically when it finishes. The button reads Cancel during the sweep; pressing it abandons the run and leaves your existing thresholds untouched.
When the sweep completes, the new thresholds are adopted immediately and the panel returns to scanning. Check the Experts journal: one line per symbol reports the derived thresholds and what percentage of history would have classified as each regime under them. Read those percentages. If Explosive covers forty percent of history, the threshold is too loose to be informative, and you should raise the explosive percentile and calibrate again.
Calibration results are stored in a StructuralBreakScanner folder inside the terminal Files directory, and reloaded automatically when the indicator restarts, so the sweep only needs to be run again when you change symbols, timeframe, or want to refresh against more recent history.
The timeframe is appended to the file name automatically. A calibration file entered as sbscanner_calibration.csv is written as sbscanner_calibration_H1.csv on an H1 scanner and sbscanner_calibration_M5.csv on an M5 one. This is not cosmetic. The distribution of the test statistic differs by timeframe, so thresholds derived on M5 are wrong when applied to H1 data, and two scanners sharing one file would silently overwrite each other with values that look plausible but do not belong to that timeframe. The same suffix is applied to the exported scan file.
Within a single timeframe, calibrating does not discard work. Thresholds already in the file for symbols outside the current watch list are carried forward, and only the symbols just swept are replaced. Two scanners on the same timeframe with different symbol lists can therefore each calibrate without erasing the other.
Choosing percentiles
The defaults of 5 and 95 mean that, over the calibration history, roughly five percent of observations would have classified as steady and five percent as explosive. Tighten toward 2 and 98 if you want rarer, higher-conviction signals. Loosen toward 10 and 90 if the scanner is too quiet on your instruments.
Alerts
Alerts fire on regime transitions, not on statistics crossing thresholds. A symbol moving from RANDOM to EXPLOSIVE is an event; a statistic oscillating either side of a boundary within one regime is not. This removes the largest source of noise in a scanner of this kind.
Three further gates apply. A new regime must persist for a configurable number of consecutive scans before it counts as a transition at all; an alert then requires at least the configured minimum confluence; and each symbol has its own re-arm interval. The first classification after startup never alerts, since otherwise the entire watch list would fire the moment the panel loads.
The confirmation requirement deserves an explanation, because it is the gate that does the most work. A statistic sitting close to a threshold does not cross it once and stay across. It moves back and forth as new bars close, and each crossing looks like a regime change to anything watching only the current value. Requiring the new reading to repeat before accepting it removes that chatter at its source. No rate limit further downstream can do this job, because a rate limit cannot distinguish a symbol flickering on a boundary from a market genuinely changing character several times.
The default of two consecutive scans is deliberately modest. Raise it to three or four on noisy instruments or short timeframes. Setting it to one disables the protection and restores alerting on every reading change, which is occasionally what you want while testing but rarely what you want while working.
If no alerts arrive
Work through these in order. The first two account for most cases.
- No regime has changed. This is the usual explanation and it is not a fault. A watch list that sits in one regime all day produces no alerts all day, by design. The AGE column tells you how long each symbol has held its current regime.
- The change was not confirmed. A new regime must hold for the configured number of consecutive scans. A reading that reverts before then is treated as noise and produces nothing.
- Confluence never reached the gate. A confirmed transition with less corroborating evidence than the minimum still updates the panel but delivers nothing. Lower the minimum to 1 to require only one supporting test, or to 0 to accept every confirmed transition regardless of corroboration.
- The channel is switched off. Only the terminal popup is enabled by default. Push and email each have their own input and both start off.
- The terminal is not configured for that channel. See below. The scanner writes a line to the Experts journal at startup naming any channel you enabled that the terminal cannot deliver.
Set Send one test alert on startup to true and reload the indicator. It delivers one message immediately through every enabled channel and reports the outcome of each in the Experts journal, which separates a delivery problem from a no-transition-yet situation in a single step. Switch it back off afterwards.
Setting up push and email
The recipient is configured in the terminal, not in this indicator. MQL5 does not permit a program to choose who receives a notification or an email, which is why there is no such input here: any product that could specify arbitrary recipients would be a spam tool. What the indicator controls is whether to send; the terminal controls where.
Push notifications. Install MetaTrader 5 on your phone and open Settings, then Messages, where you will find a MetaQuotes ID of the form 12345678. On the desktop terminal open Tools, then Options, then the Notifications tab. Tick Enable Push Notifications and paste that ID. More than one ID can be entered, separated by commas, so several devices can receive the same alert. Use the Test button on that tab to confirm before relying on it.
Email. Open Tools, then Options, then the Email tab. Tick Enable and complete the SMTP server and port, your login and password, and the From and To addresses. The To field is the recipient: change it there to send alerts somewhere other than your own inbox. Many providers now require an application-specific password rather than your account password. The Test button on that tab confirms the settings.
Push notifications are subject to a platform rate limit. Very frequent alerts can be dropped, which is a further reason to keep the confluence gate and the re-arm interval at sensible values rather than at zero.
Parameter reference
Symbols
| Parameter | Default | Notes |
|---|---|---|
| Symbol source | List | Explicit list, all of Market Watch, or the chart symbol alone |
| Symbol list | 8 majors | Comma-separated; ignored unless source is List |
| Broker suffix | empty | Appended to each name if not already present |
| Maximum symbols | 40 | Caps the working list regardless of source |
| Timeframe | Current | Independent of the chart timeframe |
Regime thresholds
| Parameter | Default | Notes |
|---|---|---|
| Steady threshold | -2.86 | ADF below this classifies as steady |
| Explosive threshold | 1.50 | ADF above this classifies as explosive |
| Chow threshold | 3.00 | Confluence gate for the Chow statistic |
| Martingale threshold | 3.00 | Confluence gate for both martingale tests |
| Calibration file | sbscanner_calibration.csv | Where results are stored; the timeframe is appended to the name automatically |
Calibration
| Parameter | Default | Notes |
|---|---|---|
| History depth | 5000 | Bars of history swept per symbol |
| Stride | 20 | Bars between evaluations during the sweep |
| Steady percentile | 5.0 | Percentile of the distribution used as the steady threshold |
| Explosive percentile | 95.0 | Percentile used as the explosive threshold |
| Work per refresh | 12 | Evaluations performed per refresh cycle during a sweep |
| Discard calibration older than | 90 days | Stored thresholds past this age are ignored and pruned; 0 keeps them indefinitely |
Raising Work per refresh shortens the sweep but gives the terminal less breathing room between slices. Lower it on a modest machine or when scanning a long symbol list.
Tests
| Parameter | Default | Notes |
|---|---|---|
| CSW/Chow window | 500 | Bars used by the CUSUM and Chow tests |
| ADF window | 252 | Bars used by ADF, SADF, and the martingale tests |
| Minimum span | 20 | Smallest admissible sub-sample |
| ADF lagged differences | 0 | Range 0 to 2; higher values absorb short-run autocorrelation |
| CSW boundary constant | 4.6 | Corresponds to a five percent pointwise level |
| Martingale penalty | 0.5 | Normalizes the statistic by sample length; 0 disables |
| Enable each test | all on | Disabled tests are skipped entirely, not just hidden |
The martingale penalty deserves a note. Without it, the trend t-statistic grows with window length and is not comparable across configurations. The default of 0.5 divides by the square root of the sample length, which puts the statistic on a scale comparable to the other tests. Setting it to zero returns the raw t-statistic.
Alerts
| Parameter | Default | Notes |
|---|---|---|
| Popup, push, email | popup only | Each channel switches independently |
| Confirmation scans | 2 | Consecutive scans a new regime must persist before it counts as a transition |
| Minimum evidence | 2 | Confluence required before an alert is delivered |
| Re-arm interval | 60 minutes | Per symbol, not global |
| Test alert on startup | false | Sends one message through every enabled channel and reports the result |
Display
| Parameter | Default | Notes |
|---|---|---|
| Panel X, Y offset | 12, 20 | Pixels from the chart corner |
| Font size | 9 | Layout scales with this and with display DPI |
| Maximum visible rows | 20 | Sorted list is truncated to this; a footer reports the total |
| Start collapsed | false | Opens as a title bar only |
| Default sort | Regime | Explosive first, confluence as the tie-break |
| Colors | six inputs | Background, text, header, and one per regime |
Chart markers
| Parameter | Default | Notes |
|---|---|---|
| Show markers | false | Vertical lines at past regime changes on the chart symbol |
| Marker scan depth | 400 | Bars of history to examine |
| Marker stride | 5 | Bars between evaluations during the scan |
Markers are off by default because the backward scan runs a full evaluation at every stride step and takes a moment on first draw. Turn them on when you want to check the classifier against what the chart visibly did, then turn them off for routine monitoring.
Performance
| Parameter | Default | Notes |
|---|---|---|
| Completed bars only | true | Prevents values changing within the forming bar |
| Symbols per refresh slice | 10 | How many symbols are evaluated per refresh |
| Refresh interval | 15 seconds | Timer period |
Scanning is deliberately spread across refresh cycles. All indicators on one symbol share a single execution thread, so evaluating a large watch list in one pass would stall chart updates. With the defaults, a 40-symbol list completes a full cycle in about a minute while each individual refresh stays brief. Raise the slice size for faster full coverage on a small list; lower it if you are scanning all of Market Watch on a modest machine.
Export
| Parameter | Default | Notes |
|---|---|---|
| Write scan CSV | false | Overwrites the file on each refresh |
| Export file name | sbscanner_state.csv | Written to the StructuralBreakScanner folder inside Files; the timeframe is appended automatically |
Interpreting the output
The scanner tells you what kind of market you are looking at. What you do with that is a strategy decision, but the mapping is reasonably direct.
- STEADY with a short half-life. Conditions where mean-reversion logic has statistical support. The half-life gives you a horizon: a reversion trade held far longer than the half-life is no longer trading the effect that was measured.
- STEADY with a long half-life. Mean reversion exists but is too slow to trade around on this timeframe. Consider the same symbol on a higher timeframe.
- RANDOM. Neither mean reversion nor persistence has support. Systems that assume either will be trading noise.
- EXPLOSIVE with high confluence. Conditions where trend-continuation logic has more support than reversion. Note that explosive behavior ends, and the test says nothing about when.
- A transition. The most informative event the scanner produces. A system tuned to the previous regime is the one most likely to start failing.
What the scanner does not do is tell you which direction to trade, how large to size, or when a regime will end. It narrows the question; it does not answer it.
Relationship to my published articles
I have published articles on structural break tests that include free source code implementing these statistics in both Python and MQL5. Anyone can download and use that code, and I would rather buyers of this product know that in advance than discover it afterward.
The article code computes the tests on a single chart and returns raw values. Everything above the mathematics is left to the reader: choosing thresholds, turning statistics into a classification, monitoring more than one symbol, alerting, and calibration.
This product is that layer. Regime classification with half-life estimation, evidence counting across five tests, empirical per-symbol threshold calibration, a sortable multi-symbol panel with chart switching, transition-based alerting with re-arm logic, and the performance work required to scan a large watch list without stalling the terminal.
If your interest is in understanding the mathematics, the articles are the better resource and they are free. If your interest is in having something monitor your watch list while you work, that is what this product is for.
Verification
Every statistic in the product was verified against an independent implementation in Python before release. The two implementations agree to within numerical precision on reference series covering quiet random walks, sustained level shifts, explosive processes, and power-law trajectories.
Frequently asked questions
Does it place trades?
No. It is an indicator and has no trading functions in it at all. It tells you what kind of market each symbol is in; what you do about that is your decision.
Can I use it to generate entry signals?
Not directly, and I would rather say so plainly. A regime is a description of market character, not a direction. STEADY says deviations tend to be corrected, which is a condition under which mean-reversion logic has support. It does not say the price is about to rise or fall. Use it to decide which of your strategies suits current conditions, not to decide when to click buy.
The panel says EXPLOSIVE but price is falling. Is that wrong?
No. EXPLOSIVE means deviations tend to grow rather than revert, and that is direction-neutral: a sustained fall is as explosive as a sustained rise. The BREAK column carries direction when the CUSUM test has fired, and that is the only column that speaks about direction at all.
Does it repaint?
No. With the default setting the tests evaluate completed bars only, so a value shown for a closed bar does not change afterwards. Turning that setting off makes the current bar update live, which is not repainting either, but it does mean the newest value moves until the bar closes.
Everything says RANDOM. Is it broken?
Almost certainly not. Major currency pairs on short timeframes genuinely spend most of their time behaving like random walks, and reporting that honestly is the point. Three things change the picture: try a higher timeframe, run a calibration so the thresholds reflect each instrument rather than a textbook constant, and give it time. If a scanner tells you something interesting is happening every hour, it is not measuring anything.
Which timeframe should I use?
H1 and above is where the tests have the most to say. The statistics need a reasonable window of history to estimate anything, and on M1 or M5 that window covers a few hours of trading during which little structural change occurs. The scanner works on any timeframe; it simply has less to report on the fastest ones.
How many symbols can it scan?
Up to sixty by default, and it will scan everything in Market Watch if you ask it to. Work is spread across refresh cycles rather than done in one pass, so a long list does not stall the terminal, but it does mean each symbol updates less often. Raise the slice size for faster coverage of a short list.
Does it work on indices, metals, crypto, and stocks?
Yes. The tests operate on log prices and assume nothing about the asset class. What does differ by instrument is the distribution of the test statistic, which is exactly what calibration is for. Calibrating matters more on instruments that are unlike currency pairs.
Do I have to calibrate before using it?
No. Without calibration the scanner uses published critical values from the econometrics literature, which are reasonable defaults. Calibrating replaces them with thresholds derived from each instrument's own history, which is usually a real improvement, but the product works properly before you do anything.
How often should I recalibrate?
Every few months is ample. The scanner discards stored thresholds older than the configured age, ninety days by default, and tells you in the journal when it has done so, so a forgotten calibration falls back to the published defaults rather than quietly applying stale numbers. Recalibrate sooner if you add instruments or change timeframe.
Can I run several copies on different timeframes at once?
Yes. The timeframe is appended to the calibration and export file names automatically, so an H1 scanner and an M5 scanner keep separate thresholds and never overwrite each other. Two scanners on the same timeframe with different symbol lists also coexist: calibration merges with what is already stored rather than replacing it.
Does it work in the Strategy Tester?
Yes, and the free demo version runs there only. In the tester the panel updates on each new bar rather than on a timer, and alerts are written to the journal instead of raising popups, since a tester run should not be sending notifications to your phone.
Will it run on a VPS?
Yes. Consider raising the refresh interval and lowering the slice size on a modest virtual machine, and disabling any tests you do not read. Push notifications and email are delivered by the terminal, so they work from a VPS provided that terminal is configured for them.
How is this different from the free code in your articles?
The articles give you the mathematics: five tests, implemented and cross-checked, computing statistics on one chart and returning raw numbers. This product is the layer above that. Regime classification, half-life estimation, evidence counting, empirical calibration, multi-symbol scanning, sorting, alerting with confirmation and re-arm logic, and the work required to do all of it without stalling the terminal. If you want to learn the methods, the articles are free and are the better resource.
What does 2/4 in the EVID column mean?
Two of the four supporting tests corroborate the classification. The regime label itself comes from a separate statistic, so a low count does not mean the label is wrong; it means less independent evidence stands behind it. Treat 3/4 and 4/4 as the readings worth acting on.
Do I get the source code?
No. Market products are distributed as compiled executables. The source for the underlying statistical tests is published free in the two articles linked above, so the mathematics is open even though this implementation is not.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
| Rows stay on loading | History is still downloading. Open each symbol's chart once to force a download. |
| Symbols missing from the panel | Name could not be resolved. Check the Experts journal for the list of dropped names and set the broker suffix. |
| Everything reads RANDOM | Thresholds are too wide for the instrument. Press Calibrate. |
| Everything reads EXPLOSIVE | Explosive threshold is too low. Raise it, or lower the explosive percentile and calibrate again. |
| Charts feel sluggish | Lower the slice size, raise the refresh interval, disable tests you do not use, or lower Work per refresh if calibrating. |
| No alerts arriving | Alerts need a regime change, not merely an explosive reading. Set Test alert on startup to true to check the channels, and see the Alerts section. |
Support
Questions and problem reports are welcome through the product comments or a private message. Reproducible issues are fixed in an update.


