거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Twitter에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
지표

PCA Synthetics - Recycle Legacy - MetaTrader 5용 지표

조회수:
9431
평가:
(14)
게시됨:
2017.01.26 09:11
\MQL5\Indicators\AIV\ \MQL5\Include\AIV\
Resources.mqh (14.94 KB) 조회
Matrices.mqh (15.47 KB) 조회
Charts.mqh (3.79 KB) 조회
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

Indicator for automatic selection of the coefficients for every instrument in a pseudo-stationary portfolio, which tends to equilibrium at zero.

The indicator requires the presence of the AlgLib library in the Include\Math folder of the terminal.


A Bit of Theory

Every instrument moves in its own direction, every direction is a separate dimension in a multidimensional array. Bu turning the matrix, that is, by multiplying its every element by a certain number, we try to find an axis, with the minimum distance the axis and all instruments, i.e. the least total variance. The number to multiply each element of the matrix then becomes the angle value, by which the moving instrument should be turned so that it moves in the same direction as other instruments. This angle value is the coefficient for every currency in the portfolio.

If the coefficient value is greater than 0 the currency is bought, if less than 0 — sold. Thus, it is possible to sustain the stationarity of the created synthetic by recalculating the coefficients from time to time. In addition, the PCA does not simply find the axis with the least variance for the portfolio, but several. The number of instruments in the portfolio is the number of components (vectors). Each of them is called the main component, and determines how much it affects the total change of the portfolio movement.


Possible problems

  1. If the chart is not drawn, see what is printed in the Experts tab. Perhaps, there are some errors or synchronizations with other charts is in progress. If there are no messages, click through other timeframes.

  2. The obtained vector values were verified with the once calculated in the R package, so the values themselves are correct. But the sign of a specific coefficient may be wrong, as the РСА does not pay attention to signs. The "-" or "+" sign can only be determined empirically, that is by trial and error.

Problem #2 with has been describes with the pictures here: http://stats.stackexchange.com/questions/34396/im-getting-jumpy-loadings-in-rollapply-pca-in-r-can-i-fix-it


Parameters

InpVector = 0; // If there are N currencies in portfolio, the movement axis number 0 = maximum variance, N - 1 = minimum
InpFrame = 300; // Floating window for calculation of coefficients, for each of InpDepth bars make InpFrame computations
InpDepth = 1000; // The total number of bars in history, for which the chart is drawn
InpForward = 500; // The bar to stop recalculating the coefficients and use the previous ones, this is OOS
InpPeriod = 1; // Smoothing for the МА, to make the chart look less twitched
InpTimePeriod = PERIOD_CURRENT; // Timeframe for the calculations
InpNormalize = true; // Normalize the prices before displaying them, to smooth the volatility gaps of USDJPY and EURGBP
InpSynthetics = true; // Draw the summary synthetic multiplied by the found coefficients or each pair individually
InpPrices = Logs; // Normalization algorithm of pairs
InpSymbols = "AUDUSD,USDCHF,USDCAD"; // Pairs for the portfolio
InpMagic = "ID" // Custom name of the indicator, to facilitate placing multiple instances on one chart without conflicts

The idea was adopted from here: https://www.mql5.com/en/code/9908


MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/16997

Relation - Chart Builder Legacy Relation - Chart Builder Legacy

Indicator for building custom charts, which are based on user-defined formula.

The MasterMind The MasterMind

The Expert Advisor uses the iStochastic (Stochastic) Oscillator, iWPR (Larry Williams' Percent Range) indicators.

Fractal_Moving_Average Fractal_Moving_Average

Fractal moving average with indication of the last value with a price label with the ability to change the averaging algorithm.

Fractal_WPR_HTF Fractal_WPR_HTF

The Fractal_WPR indicator with the timeframe selection option available in the input parameters.