Bar Range Distribution
ATR and similar tools give one number - the average range - but say nothing about the shape of the distribution behind it: whether ranges cluster tightly around that average or are spread wide with a long tail of occasional big bars. This indicator sorts the last InpLookback closed bars' ranges into InpBuckets equal-width bins and draws the resulting frequency histogram as a bar chart, so the actual shape is visible at a glance, with today's range highlighted in its own bucket for direct context. A standard indicator buffer cannot draw this shape - each buffer slot is tied to one bar on the time axis, not to one histogram bucket, so a normal plotted line has nowhere to put bucket frequency. Instead the histogram is built from fixed-size, pixel-positioned rectangle objects anchored to a chart corner, sized purely in pixels rather than price or time units. That keeps the panel a constant, readable size regardless of the symbol's price scale, the chart's zoom level or how far it has been scrolled. The panel only rebuilds when a new bar closes, not on every tick, since a histogram of closed-bar history has nothing new to show mid-bar and recomputing it on every price update would be wasted work. Notes and limitations - Purely a closed-bar histogram: it rebuilds once per new bar, not intrabar, and describes history plus the most recently closed bar - never the still-forming current bar. - If every range in the lookback window happens to be identical the bucket span is degenerate and the panel is left at its last valid state rather than dividing by zero. - Ranges are converted to pips in the summary text using the symbol's own digit count, so 3 and 5 digit quotes read the same as 2 and 4 digit ones. - The panel is pixel-positioned and independent of price scale - it does not indicate where on the chart these ranges occurred, only their distribution.
Indicator · MT4 · v1.0 · Free
About Bar Range Distribution
Bar Range Distribution is an indicator for MetaTrader 4. It has 9 settings, such as Lookback, Buckets and Corner. MQL source code included.
Files in the download: RangeDistribution.ex4, RangeDistribution.mq4, RangeDistribution.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Lookback | 500 | Closed bars included in the distribution |
| Buckets | 20 | Number of histogram bars (bins) |
| Corner | CORNER_RIGHT_LOWER | Panel corner |
| X offset | 20 | Horizontal offset from the corner, in pixels |
| Y offset | 20 | Vertical offset from the corner, in pixels |
| Bar width px | 10 | Pixel width of each histogram bar |
| Max height px | 120 | Pixel height of the tallest histogram bar |
| Bar color | clrDodgerBlue | Colour for ordinary buckets |
| Current color | clrOrange | Colour for the bucket holding the current bar's range |
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 → Indicators.
- 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 indicator from the Navigator onto a chart and adjust the settings.
Tags: ATR · MT4 Indicator · MQL4 Source Code