Unity is a cluster multi-currency indicator showing synchronous changes in the value of metals and major currencies in a generalized form. It was first published in the article "Practical Use of Kohonen Neural Networks in Algorithmic Trading. Part II. Optimizing and forecasting".
In the essence its work is described by the following algorithm. Consider it on the minimalistic example with one currency pair (EURUSD) and gold (XAUUSD).
At every moment, the market state (that is current prices, or open prices of the bars) is expressed by obvious formulae:
EUR / USD = EURUSD
XAU / USD = XAUUSD
where variables EUR, USD, XAU are pure "values" of the assets, and EURUSD, XAUUSD are constants (exchange rates, or quotes).
To find the variables, we supplement the system with another equation, limiting the sum of the squares of the variables to unity:
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 found as:
USD = sqrt(1 / (1 + EURUSD*EURUSD + XAUUSD*XAUUSD))
and all other variables can be calculated.
x0 = sqrt(1 / (1 + sum(C(xi, x0)**2))), i = 1..n
xi = C(xi, x0) * x0, i = 1..n
where n — number of variables, C(xi,x0) — the quote of i-th pair including corresponding variables. Please note, that the number of variables is 1 more than instruments.
Since the coefficients C involved in the calculation are quotes that are usually very different, in the indicator they are additionally multiplied by contract's sizes: this gives more or less comparable values (at least, of one order). To see them in the indicator window (just for information) there is an AbsoluteValues input parameter that should be set to true. By default, it is, false, of course, and the indicator calculates the increments of variables:
yi = xi0 / xi1 - 1,
where xi0 and xi1 are values on the last and the previous bars respectively.
Here is the screenshot for the cluster of EURUSD,GBPUSD,USDCHF,USDJPY,AUDUSD,USDCAD,NZDUSD,XAUUSD:
Cluster multi-currency indicator Unity, XAUUSD
The lines of assets that make up work symbol of the current chart (in this case, XAU and USD) are shown thick, the rest are thin.
The main input parameters of the indicator:
Recommended timeframes - D1 and higher.
This indicator shows average and peak speeds of price changes per minute.RSI candles - lite ressource
Improved version based on RSI_candles by © mladen 2018 https://www.mql5.com/en/code/20968