Loading…

Price Normalisation Demonstrator

Almost every published MQL trading script normalises a price the same way: NormalizeDouble(price, Digits). It is in every tutorial, and it is usually right. It is not always right, and the cases where it is wrong produce exactly the error that is hardest to debug from the outside - an invalid price or invalid stops rejection on a price that looks perfectly formatted in the log. The reason is that Digits and Point describe how a price is displayed, not the smallest increment it can actually move in. On most forex pairs those are the same thing. On metals, indices and some brokers' exotic listings, the real tick size can be a coarser grid than Point implies - a symbol quoted to three decimal places whose real tick step is 0.01, not 0.001. Rounding to the display precision alone produces a number that looks fine and sits between two valid ticks, which the server rejects. This script does not just state that as a fact - it shows it, on whatever symbol you point it at. It prints Digits, Point, the real tick size, and the tick value for that symbol, then runs a handful of sample prices near the current Bid through both the naive rounding every tutorial uses and the correct tick-aligned rounding, flagging every case where the two disagree. On a symbol where they never disagree, that is shown too, so the output demonstrates the actual behaviour of the connected broker's symbols rather than a hypothetical. It closes with a live minimum-stop-distance check: a stop deliberately placed one point from the current price, checked against the broker's minimum distance, showing exactly the calculation a trading script needs before it sends a stop loss. Notes and limitations - This script does not place, modify or close any order - it only reads market information and prints what it means. Nothing here touches an account's positions. - The live comparisons need a current Bid price; if the market for the symbol is closed or the symbol has not been subscribed to yet, that section is skipped and says so rather than showing a stale or zero price. - The real tick size is occasionally reported as 0 by a broker for a symbol that otherwise trades normally. This script falls back to Point in that case, which is the same fallback a real trading script should use. - Everything shown reflects the connected broker's current settings for that symbol; the same symbol on a different broker can behave differently, which is the point of running this rather than trusting a fixed table.

Script · MT5 · v1.0 · Free

About Price Normalisation Demonstrator

Price Normalisation Demonstrator is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 1 setting, such as Symbol. MQL source code included.

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

Settings

SettingDefaultWhat it does
SymbolSymbol to inspect (blank = current chart symbol)

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 → Scripts.
  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 script onto a chart to run it once.

Download the PDF guide

Tags: Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria