Unity - MetaTrader 5 script | Gold EA download - MT4/MT5 resources - MetaTrader 5 resources

Unity is a clustered multi-currency indicator that displays synchronized changes in the value of metals and major currencies in a common form. It was first published in the article "Practical Application of Kohonen Neural Networks in Algorithmic Trading. Part 2. Optimization and Forecasting" .
Essentially, its working is described by the following algorithm. Consider a minimalist example of a currency pair (EURUSD), and gold (XAUUSD).
At every moment, the market state (i.e. the current price or the opening price of a bar) is represented by an obvious formula:
EUR/USD = EURUSD
XAU/USD = XAUUSD
The variables EUR, USD, and XAU are the pure "value" of the asset, while EURUSD and XAUUSD are constants (exchange rates or quotes).
To find the variables, we complement the system with another equation limiting the sum of squares of the variables to units:
EUR*EUR+USD*USD+XAU*XAU = 1
Hence the name of the indicator "Unity".
Simple substitution gives:
EURUSD*USD*EURUSD*USD+USD*USD+XAUUSD*USD*XAUUSD*USD=1
Then USD can be calculated as:
USD = sqrt(1 / (1 + EURUSD*EURUSD + XAUUSD*XAUUSD))
And all other variables can be calculated.
x 0 = sqrt(1 / (1 + sum(C( xi , x 0 )**2))), i = 1..n
xi = C( xi , x 0 ) * x 0 , i = 1..n
where n — the number of variables, C( xi ,x 0 ) — the quote of the i-th pair includes the corresponding variable. Note that the number of variables is one more than the number of instruments.
Since the coefficients C involved in the calculation are often very different quotes, in the indicator they are additionally multiplied by the contract size: this gives more or less comparable values (at least the value of one order). To view them in the indicator window (only about information) there is an AbsoluteValues input parameter that should be set to true. By default, of course, it is false, and the indicator calculates the increment of the variable:
yi = x i0 /x i1 - 1,
where x i0 and x i1 are the values of the last and previous bar respectively.
Below are screenshots of EURUSD, GBPUSD, USDCHF, USDJPY, AUDUSD, USDCAD, NZDUSD, XAUUSD clusters:

Cluster multi-currency indicators Unity, XAUUSD
The asset lines that make up the current chart working symbol (XAU and USD in this case) are shown as thick lines, the rest are thin lines.
The main input parameters of the indicator:
Recommended timeframe - D1 and higher.
Attachment download
📎 unity.mq5 (10.5 KB)
📎 indarray.mqh (3.88 KB)
📎 hashmaptemplate.mqh (3.29 KB)
Source: MQL5 #26112
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •