Loading…

Normality Qq Plot

Stop and target sizing built on standard deviation quietly assumes returns are close to normally distributed - a two-sigma move is supposed to be rare. Real markets routinely have fatter tails than that assumption allows, and the cleanest way to show a trader why is a quantile-quantile plot: sort the recent sample of returns, sort a theoretical normal sample of the same size, and compare them quantile by quantile. Where the two curves overlap, the assumption is holding. Where they diverge - almost always at the extreme ends - the market's actual tails are fatter (or thinner) than the normal curve predicts, and a stop sized purely from standard deviation is mis-calibrated by exactly that amount. A conventional QQ plot is a scatter with the theoretical quantile on the X axis and the empirical quantile on the Y axis. MetaTrader indicator buffers are bar-indexed and cannot present an arbitrary continuous X axis, so this indicator instead plots both the sorted, standardised empirical returns and the sorted theoretical normal quantiles as two curves against the same rank-order X axis - bar position here stands in for "rank in the sorted sample", not a specific point in time. The teaching point survives the substitution: overlapping curves mean normal-ish behaviour, a gap at either end means fatter or thinner tails than assumed. The theoretical quantiles come from Acklam's rational approximation of the inverse standard normal CDF, accurate to roughly 1.15e-9 relative error - far more precision than a chart display needs, computed directly from polynomial coefficients with no lookup table required. Notes and limitations - This is a diagnostic and teaching display, not a trading signal - it describes the shape of recent return behaviour, it does not predict the next move. - Bar position on this subwindow is a rank axis for the sorted sample, not a timestamp; the value plotted at any given bar position does not correspond to that bar's own price action. - Returns use simple close-to-close percentage change; it does not distinguish gap moves from ordinary intrabar movement. - Uses the population standard deviation (divide by N) to standardise the sample, consistent with the convention used elsewhere in this catalogue's statistical indicators.

Indicator · MT4 · v1.0 · Free

About Normality Qq Plot

Normality Qq Plot is an indicator for MetaTrader 4. It has 2 settings, such as Sample size and Rebuild every bars. MQL source code included.

Files in the download: NormalityQqPlot.ex4, NormalityQqPlot.mq4, NormalityQqPlot.txt.

Settings

SettingDefaultWhat it does
Sample size100Number of most-recent closed-bar returns in the sample
Rebuild every bars20Recompute the plot every N new bars, not every bar

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: MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria