Triangular Deviation Meter
Three crosses sharing two legs (EURUSD, USDJPY and EURJPY, for example) should satisfy a simple identity if all three feeds are in sync: the rate implied by combining the two legs should equal the directly-quoted third symbol. In practice it rarely equals it exactly, and the naive read - "the triangle is broken, there's an arbitrage" - is almost always wrong; retail spreads and commission eat any small, steady gap long before it is tradeable. What the gap's BEHAVIOUR tells you is different: a small, steady deviation is a normal broker convention quirk (spread, rounding), while a deviation that suddenly widens and then snaps back is one leg's price feed lagging the other two - a data-quality signal, not a trading signal, but a genuinely useful one when deciding whether to trust a fast reaction on any one of the three symbols right now. This indicator plots the deviation in basis points on every closed bar, alongside the deviation's own rolling standard deviation over InpConsistencyWindow bars as a second line - a rising second line means the triangle has recently become less consistent, independent of which direction the deviation itself is currently pointing. Two combine modes are offered (InpCombineMode: multiply or divide) rather than guessed from the symbol names, because which one is correct depends entirely on which currency each leg shares with the target symbol, and broker-specific symbol naming makes parsing that from the strings alone unreliable. Notes and limitations This tool reports a raw price-identity gap, not a tradeable arbitrage - spread, commission and slippage on three separate legs routinely exceed any deviation shown here. It assumes all three symbols share the chart's timeframe and update on broadly the same schedule; a genuinely stale feed on one leg will show up as a large, held deviation rather than being detected and flagged as such. Basis points are computed against the target symbol's own price level, so the same absolute price gap reads as a larger bps figure on a low-priced instrument than a high-priced one.
Indicator · MT5 · v1.0 · Free
About Triangular Deviation Meter
Triangular Deviation Meter is an indicator for MetaTrader 5. It can alert you with a pop-up, sound, email or push message and shows several symbols in one panel. It has 8 settings, such as Leg a symbol, Leg b symbol and Target symbol. MQL source code included.
Files in the download: TriangularDeviationMeter.ex5, TriangularDeviationMeter.mq5, TriangularDeviationMeter.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Leg a symbol | EURUSD | First leg of the triangle |
| Leg b symbol | USDJPY | Second leg of the triangle |
| Target symbol | EURJPY | Directly-quoted third symbol the implied rate is compared against |
| Combine mode | TRI_MULTIPLY | How LegA and LegB combine into the implied rate |
| Symbol suffix | Broker suffix appended to all three symbols, leave blank if none | |
| Consistency window | 20 | Bars the deviation's own rolling stdev ("consistency") is measured over |
| Deviation alert bps | 0.0 | Alert when |deviation| exceeds this many basis points (0 = never) |
| Alerts | true | Alert once per closed bar when the threshold is crossed |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Arbitrage · EURUSD · USDJPY · Alerts · Dashboards & Scanners · MT5 Indicator · MQL5 Source Code