Copula.mqh는 두 시계열이 상관관계를 넘어, 특히 최악의 날과 최상의 날에 어떻게 함께 움직이는지를 측정합니다. 이 함수는 데이터의 순위에 대해 최대우도법을 사용하여 5가지 이변량 코풀라(가우시안, 스튜던트 t, 클레이튼, 검벨, 프랭크)를 적합시키고, 켄달의 타우, 꼬리 의존도, 공동 극단값 발생 확률, 코풀라 계열 선택을 위한 AIC, 코풀라 페어 트레이딩에 사용되는 조건부 확률 및 무작위 추출값을 제공합니다. DLL은 필요하지 않으며, 정규 분포 및 t 분포 함수는 표준 라이브러리(Math\Stat)에서 제공됩니다.
#include <Copula\Copula.mqh>
double x[], y[]; // returns of two symbols on the same bars
// ... fill x and y ...
double u[], v[];
CCopula::Ranks(x, u); // pseudo-observations in (0, 1)
CCopula::Ranks(y, v);
CCopula c;
c.SetData(u, v);
if(c.Fit(COPULA_STUDENT))
{
double lower = c.LowerTail(); // limit of P(y crashes | x crashes)
double joint = c.JointLower(0.05); // P(y in its worst 5% | x in its worst 5%)
double aic = c.AIC();
double h = c.H(u[ArraySize(u) - 1], v[ArraySize(v) - 1]); // P(U <= u | V = v) for the last bar
} CopulaReport.mq5 스크립트는 두 개의 심볼을 받아, 5개의 코큘라를 해당 수익률에 적합시키고, AIC 순으로 순위를 매긴 뒤, 데이터가 보여주는 결과와 나란히 각 코큘라에 대한 꼬리 의존성과 공동 최악 및 최상의 5% 일의 확률, 그리고 마지막 막대의 조건부 확률을 출력합니다(그림 1). D1 차트의 금과 은의 경우, Student t 코퓰라가 가장 적합합니다. 꼬리 의존성이 없는 가우시안 코퓰라는 데이터가 67%를 나타내는 반면, 공동 5% 일수를 50%로 산출합니다(그림 2).


4개의 시뮬레이션 샘플(가우시안, 스튜던트 t, 클레이튼 및 검벨 의존성)과 금 및 은의 H4 수익률에 대해 독립적인 scipy 버전과 비교하여 25회 적합을 수행한 결과:
Copula.mqh는 MQL5\Include\Copula에, CopulaReport.mq5는 MQL5\Scripts\Copula에 저장합니다.
MetaQuotes Ltd에서 영어로 번역함.
원본 코드: /en/code/78906
GotobiDays - include file to find Gotobi days (Japanese payment dates)
Include file with small functions to find the Gotobi days: the 5th, 10th, 15th, 20th, 25th and the last day of each month, moved back to the previous business day when they fall on a weekend or a holiday you list. Information only, no trading functions.
GSLP Active Research EA for Gold
Free MT5 research EA with three closed-bar entry models, ATR stops, fixed-R targets and a tester cost ledger. Version 2.31 uses the chart symbol and timeframe. Historical research: XAUUSD M5. Educational source; published tests were loss-making.
ChangePoint: Bayesian online change point detection
평균 또는 변동성의 변화를 온라인으로 감지하는 방법 (Adams-MacKay): 최근 k 바 동안의 변화 확률, 현재 구간 길이, 예측값 및 지표.
Account Recorder - balance, equity and day drawdown to CSV every minute (service)
A service that writes your balance, equity, floating result, margin and the drawdown from today's highest recorded equity to a CSV file every minute. Runs without a chart and never trades.