This indicator allows the formulation of a synthetic instrument from a list of other instruments.
The method is similar to what is available on TradingView where you can enter a math function.
The indicator allows two modes: "Linear Product" or "Geometric Mean"
Linear product allows direct conversion of pairs to a new pair
For Example Gold in GBP: XAUGBP = XAUUSD / GBPUSD
Geometric Mean is more suitable to create an index of several components priced in different measurements (see Wikipedia for math description).
For example European Stocks = (GER30 x FRA40 x UK100 x ESP35 x ESTX50)^(1/5)
ie. the product of the Indices raised to the power of 0.2 ...as in 1/(number of instruments)
It can also be used to generate a currency strength:
GBP Strength = (GBPUSD / EURGBP x GBPCAD x GBPCHF x GBPAUD x GBPJPY x GBPNZD)^(1/7)
The numerators being GBP and denominators other currencies - in this case EURGBP is inverted as defined in indicator parameters.
USD Strength = (1/EURUSD / GBPUSD x USDCAD x USDCHF x USDJPY / AUDUSD / NZDUSD)^(1/7)
it could be extended by adding other currencies outside the Majors such a USDCNH, USDNOK, etc..
The code is limited to 10 currencies.
Edit this line at start of code to change: "local MAX_INSTRUMENTS = 10;"
Other ideas might be
Averaged Oil = (USOil x UKOil)^(1/2)
Oil not in Dollars = (USOil / USDOLLAR)
Scandinavia strength = (1/USDNOK / USDSEK / EURNOK / EURSEK)^(1/4)
and so on...
Examples of output shown below.
- the indicator allows bid/ask source data and for different timeframes
- output is selectable a candles, open, high, low, close, median, typical, weighted
- high/low are via an approximation so may not be accurate unless short timeframe data is used
- volume is also available via sum of sum of input instrument volumes
- output streams are available external to the indicator either as a candle stream or singly as a selected stream. This should allow adding existing indicators to the chart.
Hope it works - have fun
Steve