Loading…

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

SettingDefaultWhat it does
Lookback500Closed bars included in the distribution
Buckets20Number of histogram bars (bins)
CornerCORNER_RIGHT_LOWERPanel corner
X offset20Horizontal offset from the corner, in pixels
Y offset20Vertical offset from the corner, in pixels
Bar width px10Pixel width of each histogram bar
Max height px120Pixel height of the tallest histogram bar
Bar colorclrDodgerBlueColour for ordinary buckets
Current colorclrOrangeColour for the bucket holding the current bar's range

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: ATR · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria