thank you)) I used the old version from the cointegration thread for more than 2 pairs)
you can slightly correct the comment in the first line, not N, but N-1
You have a reference to R.
1. What package(function) was used?
2. What in R corresponds in the indicator?
Sent it for review, thanks
for one bar the calculation was approximately like this, for each bar of history this code should be wrapped in a loop
skips <- lines[-1]
sources <- read.csv(textConnection(skips), header = T, sep = ",", quote = "'", dec = ".", fill = F, stringsAsFactors = F, colClasses = c("NULL", NA, NA, NA), check.names = F)
components <- princomp(sources, cor = F)
summary(components)
components$loadings
data in quotes.csv is approximately in this format
1,1.24472,1.24467,1.24475
2,1.24474,1.24470,1.24465
3,1.24475,1.24473,1.24457
4,1.24484,1.24462,1.24474
5,1.24488,1.24456,1.24481
sent it for review, thanks.
for one bar the calculation was approximately like this, for each bar of history this code should be wrapped in a loop
skips <- lines[-1]
sources <- read.csv(textConnection(skips), header = T, sep = ",", quote = "'", dec = ".", fill = F, stringsAsFactors = F, colClasses = c("NULL", NA, NA, NA), check.names = F)
components <- princomp(sources, cor = F)
summary(components)
components$loadings
The data in quotes.csv is approximately in this format.
1,1.24472,1.24467,1.24475
2,1.24474,1.24470,1.24465
3,1.24475,1.24473,1.24457
4,1.24484,1.24462,1.24474
5,1.24488,1.24456,1.24481в
I understand correctly: with the help of PCA you created a synthetic, and then see the deviation from this synthetic of a particular currency pair?
1. I tried to use it as an oscillator, i.e. when it is down, calculate coefficients, buy and hold until we get a profit, if there is no profit, move the OOS line, recalculate coefficients, level the position
2. then I tried the idea of master - slave, because Hrenfiks mentioned it in Resikl, for example, to buy or sell currency with a slightly lower coefficient from the maximum, somehow it didn't work either
how to catch the sliding - I don't know, the basket should move towards the strongest vector (the pair with the highest coefficient), but averagely, deviating towards other pairs, so the real pair and the synthetic will still not converge, and until the problem with the sign change is solved, the synthetic can simply be displayed upside down, so it is still unclear when to buy and when to sell.
about strategies - no
1. I tried to use it as an oscillator, i.e. when it is down, calculate coefficients, buy and hold until we get a profit, if there is no profit, move the OOS line, recalculate coefficients, level the position
2. then I tried the idea of master - slave, because Hrenfiks mentioned it in Resikl, for example, to buy or sell currency with a slightly lower coefficient from the maximum, somehow it didn't work either
how to catch the sliding - I don't know, the basket should move towards the strongest vector (the pair with the highest coefficient), but averagely, deviating towards other pairs, so the real pair and the synthetic will still not converge, and until the problem with the sign change is solved, the synthetic can simply be displayed upside down, so it is still unclear when to buy and when to sell.
I understand that you, unlike many others on this forum, are familiar with R. Why not use its capabilities. After all, it solves all the problems mentioned above. It is called co-integration. It is widely used...
in general, in this case R is not necessary.
all the necessary minimum for pair trading is already available in the libraries on µl - the usual MNC, PCA, correlation, adf test, if necessary skeewness and kurtosis.
in general, in this case R is not needed.
all the necessary minimum for pair trading is already available in the libraries on µl - the usual MNC, PCA, correlation, adf test, if necessary skeewness and kurtosis.
Why doesn't anyone else have this? And on several branches at the same time. That's what I don't understand
do not use pair trading, do not use these methods, do not discuss them publicly - there are many variants.
I made a similar EA that calculates through R, but it's hard to test.
Later, I will try to replace the calculation via mcl libraries, maybe it will be faster to test.
Dear Andy,
I have not found the Normalize parameter. Maybe the prints are from another version?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
PCA Synthetics - Recycle Legacy:
Indicator for automatic selection of the coefficients for every instrument in a pseudo-stationary portfolio, which tends to equilibrium at zero.
Author: Andy Sanders