Most foreign money energy meters use arithmetic calculations — easy pip variations or proportion modifications averaged throughout pairs.
There’s a mathematically cleaner strategy that solves a number of issues directly.
When measuring the energy of EUR in opposition to 7 different main currencies, the arithmetic strategy sums the pip modifications of all 7 EUR pairs.
This works, but it surely creates a scaling drawback. EURJPY strikes 100 pips whereas EURCHF strikes 10 pips.
The JPY pair dominates the calculation no matter its precise significance.
The geometric imply strategy takes the seventh root of the product of all 7 pair values.
Every pair contributes proportionally to the ultimate index worth, no matter its absolute worth degree.
A 1 p.c transfer in EURCHF has the identical influence on the EUR index as a 1 p.c transfer in EURJPY.
In MQL5, this may be carried out utilizing the CustomSymbolCreate operate to generate artificial chart symbols.
The formulation for a EUR basket index appears to be like like this:
pow((EURCAD * EURCHF * (EURJPY/100) * EURAUD * EURUSD * EURGBP * EURNZD), 0.142857)
The division of EURJPY by 100 normalizes the JPY pairs to the identical scale as the opposite pairs.
The exponent 0.142857 is just 1/7.
What makes this attention-grabbing is a mathematical property that emerges once you calculate all 8 foreign money indices this manner.
The sum of all 8 day by day pip modifications all the time equals zero.
If EUR gained 45 pips and USD gained 124 pips throughout their respective baskets, the remaining 6 currencies should collectively present precisely -169 pips.
This zero-sum property will not be an approximation.
It’s a mathematical certainty of the geometric imply development utilized to a closed set of currencies.
It offers a built-in validation mechanism: in case your calculations don’t sum to zero, one thing is unsuitable.
For anybody interested by constructing customized artificial symbols in MT5, the important thing capabilities are CustomSymbolCreate, CustomRatesUpdate and CustomTicksAdd.
The primary problem is dealing with dealer rollover intervals round midnight the place unfold widening can create synthetic spikes in your artificial charts.
I’ve printed a free indicator on the CodeBase that demonstrates the geometric imply strategy utilized to the USD index:
MATTRIX USDx Evaluate. It compares the official ICE-weighted USDX with an equal-weighted model utilizing the identical 6 pairs.
https://www.mql5.com/en/code/72600