DataSnooping.mqh는 모든 최적화 과정 뒤에 따라오는 질문에 답을 제공합니다. 즉, 여러 전략(또는 하나의 전략에 대한 여러 매개변수 세트) 중 가장 우수한 것이 벤치마크를 능가했지만, 그것이 정말로 더 우수했던 것일까, 아니면 단지 그중에서 가장 운이 좋았던 것일 뿐일까? 이 모델에는 우수한 예측 능력(SPA)을 평가하는 핸슨(Hansen)의 테스트, 화이트(White)의 리얼리티 체크(Reality Check), 벤치마크보다 우수한 모든 전략을 찾아내는 로마노-울프(Romano-Wolf)의 StepM 절차, 그리고 핸슨, 룬데(Lunde), 네이슨(Nason)의 모델 신뢰 구간이 포함되어 있습니다. 부트스트랩은 일일 결과 간의 의존성을 유지하며(정적 부트스트랩), 시드 값을 사용합니다. DLL 파일 없음.
#include <DataSnooping\DataSnooping.mqh>
matrix returns; // one column per strategy (or parameter set), one row per day
vector benchmark; // returns of the benchmark on the same days (zeros: no position)
// ... fill returns and benchmark ...
CSuperiorAbility spa;
spa.SetData(returns, benchmark, true); // true: higher is better
spa.Options(2000, 0.0, true, 1); // draws, mean block (0: square root of the days), studentized, seed
if(spa.Compute())
{
double p = spa.PValue(1); // consistent SPA p-value: is the best really better?
int better[];
int n = spa.StepM(0.05, better); // all the strategies better than the benchmark at 5%
}
CModelConfidenceSet mcs;
if(mcs.Compute(returns, true, 2000))
{
bool kept = mcs.Included(0, 0.1); // is strategy 0 in the 90% set of the best?
} 이 검정들은 Python 패키지 arch를 따르며, 동일한 부트스트랩 추출을 사용할 경우 arch와 동일한 p-값을 제공합니다. arch의 SPA 클래스에는 studentize 옵션이 있지만, 버전 8.0에서는 계산 시 표준 편차로 나누지 않으므로 옵션 설정과 관계없이 표준화되지 않은 검정 결과를 반환합니다. 여기서 Options(..., studentize = false, ...)는 arch와 동일한 수치를 제공하며, studentize = true는 한센(Hansen)의 통계량을 제공합니다. 이 통계량에서는 평균은 높지만 결과의 변동성이 매우 큰 전략은 더 안정적인 전략보다 낮은 가중치를 받습니다.
SnoopingExample.mq5 스크립트는 특정 종목에 대해 100개의 이동평균 규칙을 구축합니다(빠른 이동평균이 느린 이동평균보다 높을 때는 매수, 그 외에는 보합, 빠른 이동평균 10개, 느린 이동평균 10개)에 대해 100개의 이동평균 규칙을 생성하거나, CSV 파일에서 사용자가 직접 만든 전략의 수익률을 읽어온 다음, 단독으로 테스트된 최상의 규칙의 p-값을 SPA, Reality Check, StepM 및 모델 신뢰도 세트 결과와 비교합니다(그림 1). US30 D1 차트에서 최상의 규칙은 t-통계량 1.72를 보입니다: 단독으로 테스트했을 때는 p-값이 0.043이며, 100개 중 최상의 규칙으로 선정되었을 때는 SPA p-값이 0.19입니다(그림 2).


그림 3: 빠른 평균과 느린 평균에 따른 각 규칙의 t-통계량. 인접한 규칙들은 대부분 같은 요일에 시장에 진입하기 때문에 유사한 수치를 보입니다. SPA 테스트와 Reality Check의 부트스트랩은 이러한 의존성을 유지합니다. 본페로니 보정을 적용하면 이 의존성을 무시하게 되어 기준이 지나치게 엄격해질 것입니다.

그림 4: 동일한 최상의 규칙인 SMA 5/160. 단독으로 테스트했을 때, 이 규칙의 p-값은 0.043으로 5% 미만이다. 시도된 100개 규칙 중 최상의 규칙으로 간주할 경우, p-값은 0.244(리얼리티 체크)와 0.187(SPA)로 나타난다. 이는 시장 참여를 자제하는 것보다 이 규칙이 더 낫다는 것을 입증할 만한 근거가 전혀 남지 않았음을 의미한다.

arch 8.0으로 도출한 부트스트랩 지수(정적 부트스트랩, 1,000회 추출)를 바탕으로 세 가지 데이터 세트(50개 전략 중 3개는 실질적인 우위를 가지며, 200개는 상관관계가 있는 매개변수 세트로서 우위가 없고, 9개 샘플 Expert Advisor의 일일 결과)를 분석한 결과:
DataSnooping.mqh는 MQL5\Include\DataSnooping에, SnoopingExample.mq5는 MQL5\Scripts\DataSnooping에 저장합니다.
MetaQuotes Ltd에서 영어로 번역함.
원본 코드: /en/code/78806
EzoO Close All - close all, profitable, losing, buy or sell positions in one click
Script that closes positions in one click: all, only profitable, only losing, only buys or only sells, for this symbol or all symbols, with a magic filter and optional pending order delete.
EzoO Daily Loss Guard - daily loss limit and profit target for the whole account
Daily loss limit and daily profit target for the whole account (prop firm style). When a limit is hit it closes positions, deletes pending orders and keeps the account flat until the next daily reset.
Basket Pair Closer
MT5용 포지션 관리 도구로, 최고 수익 포지션과 최악의 손실 포지션을 합산한 결과가 사용자가 설정한 최소값에 도달하면 두 포지션을 동시에 청산합니다. 바스켓 방식의 수익 실현 및 손절매(금액 기준), 매직 필터, 간편한 패널을 제공합니다. 그리드 전략, 마틴게일 전략 및 수동 거래와 호환됩니다. 오픈 소스 코드입니다.
VolumeProfile_POC_Zones
Dynamic Volume Profile indicator for MetaTrader 5 displaying horizontal volume distribution, Point of Control (POC), and Value Area (VAH/VAL) zones. Includes a layout switcher to anchor the histogram on either the right or left side of the lookback range.