Finding the Natural Relationship of Currencies

 
Perhaps someone knows and is willing to share the method for calculating the perfect synthetic?
By ideal synthetician I mean one that can select currency pairs to minimize variance, rather than adjusting ratios to those already selected.

Two already tested methods - PCA(https://www.mql5.com/ru/code/16997) and Linear Regression(https://www.mql5.com/ru/code/11859) have the main and inexhaustible problem - they try to create correlations where there are none. In fact, here there is a fitting through fitting the share of each instrument in the portfolio, as a result it all quite predictably collapses on OOS.

I just want to find combinations of instruments that have minimal dispersion on history WITHOUT any coefficients. It is desirable that the search of possible combinations is non-linear, or rather includes linear (X1 + X2 + X3) and non-linear (X1 / X2 + X3 ^ 2) combinations.
 
Andy Sanders:
Perhaps someone knows and is willing to share the method for calculating an ideal synthetic?
By an ideal synthetician I mean one that is able to select currency pairs to minimize dispersion, rather than fitting ratios to those already selected.

Two already tested methods - PCA(https://www.mql5.com/ru/code/16997) and Linear Regression(https://www.mql5.com/ru/code/11859) have the main and inexhaustible problem - they try to create correlations where there are none. In fact, here there is a fitting through fitting the share of each instrument in the portfolio, as a result it all quite predictably collapses on OOS.

I just want to find combinations of instruments that have minimal dispersion on the history with no coefficients at all, at that it is desirable to have non-linear search of possible combinations, or rather to include linear (X1 + X2 + X3) and non-linear (X1 / X2 + X3 ^ 2) combinations.

Such a synthetic cannot exist in principle because:

1. all pairs are correlated;

2. the correlation of the pairs changes over time due to macro-indicators.

 
Дмитрий:
1. to clarify the question in view of the comment, how to find the mentioned synthetic at a certain interval, perhaps in the period between changes in correlation between currencies?
2. let's say the correlations change, but the rise or fall of the currency is not infinite, it will still be kept in a certain corridor, so there is always the most compressed combination

It is not necessary that this combination has a constant minimum variance. We just need an algorithm that goes through the following formulas

X1 * X2
X1 + X2 + X3
X1 * (X2 + X3)
X1 - X2 + X3 * X4
 
Andy Sanders:
1. to clarify the question in view of the comment, how to find the mentioned synthetic at a certain interval, perhaps in the period between changes in correlation between currencies?
2. Let's assume that correlations change, but growth or decline of a currency is not infinite, it will still be kept in a certain corridor, so there is always the most compressed combination

not necessarily that this combination should have a constant minimum variance, just some algorithm that will independently enumerate formulas like

X1 * X2
X1 + X2 + X3
X1 * (X2 + X3)
X1 - X2 + X3 * X4

Neural networks.

 
Andy Sanders:
Perhaps someone knows and wants to share the method of calculating the ideal synthetic?
By an ideal synthetic trader I mean one that is able to select currency pairs to minimize variance, rather than fitting ratios to those already selected.

Two already tested methods - PCA(https://www.mql5.com/ru/code/16997) and Linear Regression(https://www.mql5.com/ru/code/11859) have the main and inexhaustible problem - they try to create correlations where there are none. In fact, here there is a fitting through fitting the share of each instrument in the portfolio, as a result it all quite predictably collapses on OOS.

I just want to find combinations of instruments that have minimal dispersion on history WITHOUT any coefficients. It is desirable that the search of possible combinations is non-linear, or rather includes linear (X1 + X2 + X3) and non-linear (X1 / X2 + X3 ^ 2) combinations.

The ideal synthetic was formulated by Granger, for which he received a Nobel Prize.

The meaning is as follows.

Take two pairs (or n pairs).

Combine these pairs so that the remainder of them is stationary. There are ready-made packages for this. Tests to check if the residue is stationary have been invented.

Then we trade by making trading decisions based on this stationary residue.

The most widely used trading strategy.

 
Дмитрий: Neural networks.
Sonically ...
Neural networks expect to be given some reference example to strive for, that is, to what point to learn.
In this case, it is not clear how to make them generate formulas. I am afraid that when you try to set formulas in advance, it turns out that the network is just not needed at all.
I need exactly the mechanism of generation of formulas. I can cycle through the results of executing each of them anyway :)

For example, what spins in my head, there is an algorithm for generating all possible permutations, all possible combinations from a list of given elements, for example
var min = -1;
var index = 0;
var combos = []
var list = [ EURUSD, GBPUSD, USDCAD, USDJPY, EURGBP ]

for k in list
{
    for n in list
    {
        combos [index] = list [k] + list [n]  //  сюда как-то надо вклинить знаки сложения, умножения, деления, только простая арифметика
        
        var expression = evaluateExpression (combos [index])

        min = expression < min ? expression : min
        index++
    }
}
Permutations are a bit more complicated, the example above is just to clarify what is needed ...
 
СанСаныч Фоменко:

The ideal synthetic was formulated by Granger, for which he received a Nobel Prize.

The meaning is as follows.

Take two pairs (or n pairs).

Combine these pairs so that the remainder of them is stationary. There are ready-made packages for this. Tests to check if the residue is stationary have been invented.

Then we trade by making trading decisions based on this stationary residue.

The most widely used trading strategy.

Granger, not Granger.

He analysed the stock market of the 60s, not forex of the 2000s.

There is no combination of currency pairs in forex that gives a stationary residual.

 
Andy Sanders:
Sonically ...



An optimisation problem then.

You formulate a target function, e.g. variance to a minimum.

You formulate a number of portfolio constraints - total balance, diversification, etc.

You solve it - there are a lot of methods.

 

Ideally, a linear otiimisation problem.

Simplex method.

Or as in Excel - stupid overshooting

 

I keep statistics on the number of trend synthetics to buy, made up of 8 currencies. The weight of the synthetic is limited to 6000 USD.

When the number rises, it is a trend. A fall is a change in trend direction. This is the first time I see a number of them around 16000. So that's as much to sell (change the sign). And how many are neither there nor there. And their distribution by number from the weight limit, thousand USD

 
Alexander Laur:

The ideal synthetic is a neutral triangle. The trade is in a stationary channel. The ratio of volumes in the synthetic is inversely proportional to their collateral ratio.

When the number of pairs in a synthetic increases, overheads increase: spread, commission, swap.

And because any combination of currencies in forex cannot form a "perfect triangle" over a long period of time, ................................................
Reason: