Loading…

Pip And Point Converter

"A pip is ten points" is a rule that only applies to 3 and 5 digit quotes. Code that hardcodes the number 10 works on EURUSD and quietly produces a stop distance ten times too large - or, on a JPY cross with a mismatched assumption, ten times too small - on the first instrument that does not fit the textbook case. Metals, indices and 2-digit JPY-style quotes all have no fractional pip digit at all, so a pip and a point are the same size on them. This header exists to remove that assumption. PipMultiplier reads MODE_DIGITS for the symbol on every call and returns 10.0 only when the digit count is 3 or 5, and 1.0 otherwise. Every other function is built on top of it, so the correct multiplier is always derived from the symbol in front of you, never carried over from whichever instrument the code was first tested against. Four functions cover the conversions that come up in practice: PipsToPoints and PointsToPips move between the two point-scale units; PipsToPrice and PriceToPips move between a pip count and an actual price offset you can add to or subtract from Bid or Ask. All four accept fractional values, because a half-pip distance is a real and useful number when sizing a tight stop. The header is self-contained - no #include of anything else in this catalogue, including the LotNormalize library, even though it needs the same few lines of digit-checking logic. Duplicating four lines is cheaper than creating a submission that fails to compile because a downloader only installed one of two libraries. Notes and limitations - Depends on the digit/point lookup returning valid values for the symbol, which requires the broker to have synchronised it at least once. The demo calls SymbolSelect first and skips a symbol cleanly if it is not available, on both platforms. - PipMultiplier treats every non-3-and-5-digit symbol as a 1:1 pip/point ratio. That is correct for the common 2-digit metal and index cases this header targets, but a broker running an unusual non-standard digit count for a specific instrument should be checked against its contract specification rather than assumed. - This header does no rounding or lot-size work. It converts distances only; pair it with a volume-normalisation library when sizing an actual order.

Script · MT5 · v1.0 · Free

About Pip And Point Converter

Pip And Point Converter is a script for MetaTrader 5. It shows several symbols in one panel and is set up for gold (XAUUSD). It has 2 settings, such as Test pips and Test price distance. MQL source code included.

Files in the download: PipConverter.mq5.mqh, PipConverter.txt, PipConverterDemo.ex5, PipConverterDemo.mq5.

Settings

SettingDefaultWhat it does
Test pips12.5Pip value used in the worked examples below
Test price distance0.00250Raw price distance used in the PriceToPips example

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: EURUSD · Dashboards & Scanners · Gold (XAUUSD) · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria