Range Extension Probability Table
Traders watch how much of the average daily range has already traded by a certain time and use it to judge how much room is left, but that judgement is usually a feel rather than a checked number. This script checks it: for every historical day, it computes the average daily range from the days BEFORE that day, measures how much of that range had already been used by a chosen cut-off time, sorts days into buckets by that used-so-far percentage, and reports how often the day extended further and by how much. The average daily range baseline is deliberately built from PRIOR days only, never the day being scored. Including the day's own outcome in its own baseline would answer a different question than the one a trader standing at the cut-off actually faces, because they cannot see the rest of that day yet either. Results are expressed as a percentage of ADR rather than pips, so a bucket built from a quiet pair and one built from a volatile pair or an index mean the same thing: "roughly this fraction of a typical day" rather than a number whose scale depends on the instrument. Notes and limitations - A day is skipped entirely if the market had not opened by the cut-off time (no intraday bar available at or before it), rather than being scored on no data. On symbols with a late session open, a very early cut-off can produce a small sample - check the day count printed in the summary. - The intraday feed and the daily bar can disagree by a tick at the extremes of the range; any resulting negative "extra range" is clamped to zero rather than reported as a day that shrank. - This is a descriptive study of history, not a live intraday indicator - it does not watch the current session or alert in real time. - A high probability of "extending further" in a bucket does not say how far the extension went beyond the minimum, only that it cleared the threshold; the mean extra range column is the companion figure for that.
Script · MT4 · v1.0 · Free
About Range Extension Probability Table
Range Extension Probability Table is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 10 settings, such as Symbol, Intraday timeframe and Adr period. MQL source code included.
Files in the download: RangeExtensionProbabilityTable.ex4, RangeExtensionProbabilityTable.mq4, RangeExtensionProbabilityTable.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Symbol | Symbol to study, blank = this chart's symbol | |
| Intraday timeframe | PERIOD_M15 | Timeframe used to measure range up to the cut-off |
| Adr period | 20 | Average daily range lookback, in prior days |
| Max days | 500 | Most recent completed days to include |
| Cutoff hour | 12 | Cut-off hour, terminal/server time (0-23) |
| Cutoff minute | 0 | Cut-off minute (0-59) |
| Bucket size percent | 25.0 | Width of each "% of ADR used" bucket |
| Min extension percent | 5.0 | Minimum extra range, as % of ADR, to count as "extended further" |
| Save csv | true | Write the bucket table to a CSV file |
| Delimiter | DelimiterComma | CSV column separator |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Alerts · MT4 Script · MQL4 Source Code