Loading…

Price Z Score

Bollinger %B and similar band-position readings depend on the band width you chose, so a 0.8 reading on one symbol is not the same "stretch" as a 0.8 reading on another. This indicator instead computes the actual Z-Score - (Close minus the rolling mean) divided by the rolling standard deviation - so a reading of 2.0 always means the same thing: price is two standard deviations above its own recent average, on any symbol, on any timeframe. The rolling mean and standard deviation use the population formula (dividing by N, not N-1), matching what MetaTrader's own built-in Standard Deviation indicator already computes. That was a deliberate choice: a trader who already trusts the built-in reading gets the same numbers here, just turned into a single normalised line instead of a separate band. Dotted level lines are drawn at +/-2 and +/-3 sigma, the conventional "stretched" and "extreme" thresholds. An optional alert fires once when the line crosses the configured level on a closed bar, so the indicator can flag mean-reversion setups without needing to be watched constantly. Notes and limitations - Uses the population standard deviation formula (divide by N), matching MetaTrader's built-in Standard Deviation indicator rather than a textbook sample-variance formula. - If a window is perfectly flat (zero standard deviation, e.g. a dead symbol with no movement) the Z-Score is reported as 0 rather than dividing by zero. - Fully causal: every value is computed only from closed bars up to and including the bar it is plotted on; nothing recalculates or repaints once a bar has closed. Alerts are explicitly gated to bar 1 (the last closed bar), never bar 0, so the still-forming bar cannot fire twice. - A high Z-Score is a statistical description, not a trade signal on its own - price can and does stay stretched for extended periods in a strong trend.

Indicator · MT5 · v1.0 · Free

About Price Z Score

Price Z Score is an indicator for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 3 settings, such as Period, Alert level and Alerts. MQL source code included.

Files in the download: PriceZScore.ex5, PriceZScore.mq5, PriceZScore.txt.

Settings

SettingDefaultWhat it does
Period20Lookback bars for the rolling mean and standard deviation
Alert level2.0|Z-Score| that triggers an alert on bar close
AlertstrueAlert once per closed bar when |Z-Score| crosses the level

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 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: Bollinger Bands · Oscillator · Alerts · MT5 Indicator · MQL5 Source Code

MetaTrader 4 & 5 indicators · PolyMaria