거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Telegram에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
조회수:
16090
평가:
(35)
게시됨:
2012.09.19 15:00
업데이트됨:
2016.11.22 07:32
\MQL5\Include\
mymql_v2k1.mqh (15.42 KB) 조회
printlog.mqh (1.05 KB) 조회
tandem.mq5 (18.5 KB) 조회
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

If you are not familiar with pair trading, you can find information in the Literature section. The idea can be briefly described as follows: 

If we compare the charts of two similar assets by putting them on one another, we will see that they diverge at a certain distance and then converge again. This happens again and again. Why shouldn't we use that to make money?

 

The Expert Advisor is set on EURUSD H1. GBPUSD is selected as the default correlating pair (Symbol2 variable or "Indirect symbol"). The Expert Advisor tracks the market following that plan but do not confuse it with synthetics! Synthetic analysis is based on constant averaging and dragging both assets in. In this case, the charts are simply overlayed. But before overlaying, my Expert Advisor defines unrestricted starting point. Starting from there, it is assumed that two pairs have crossed for the first time. Then we scale Symbol2 so that its price fluctuations range was roughly similar to the range of the symbol, at which the Expert Advisor is installed. Some statistics is gathered for Range ("Field of training") candles. Maximum symbol divergences for this period are found. Further on, if the divergence by CorrectLimit ("Correction of signal border") from the maximum one occurs, a new position is opened. Or, if more precisely, pair of positions is opened (one position for each symbol). If symbols continue diverging, the second pair of deals is opened after the same number of points. The maximum number of such deals is limited by MaxDeals variable ("Maximum number of transactions").

CorrectDist variable ("Coefficient length of the search of separation") changes the value of the training period for deeper analysis.

The Expert Advisor trades on two currency pairs with both direct and reverse correlation. Correlation switch ("The correlation coefficient") is used for that. However, you can also trade on one pair analyzing divergences of two pairs. For example, you can trade on EURGBP instead of trading on two pairs EURUSD and GBPUSD. To do this, enter "EURGBP" without the quotes into Cross variable ("Which pair to trade instead of two (cross)"). If you are going to trade on GBPEUR, specify false value to the Expert Advisor in CrossType ("Direct cross-rate") variable.

After the expiration date of the knowledge obtained during the last training, retraining is performed via Optimum ("Interval of retraining") candles.

The Expert Advisor has 2 signals for closing all deals. If the symbols are moving back by CloseCorr ("Close on reducing of discrepancies") from the maximum divergence and when reaching Profit % in open positions.

mqh include files contain auxiliary functions for the Expert Advisor correct operation.
MyMQL_v2.1.mqh - functions for adaptation of the Expert Advisor from MQL4 programming language to MQL5;
PrintLog.mqh - necessary for creating equity.csv table in Files folder when testing the Expert Advisor. The table contains the history of account equity changes. This information can be used for a detailed analysis of drawdowns during the tests. Also, equity changes' graphs of various trading systems can be overlayed.

Test with default parameters for 11 years by open prices on EURUSD H1:


Literature:

September 8, 2012 - improved the Expert Advisor code considering comments on possible "holes" in an indirect symbol's history. 

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

BrakeExp BrakeExp

Simple trend indicator displayed in the form of NRTR.

i-AnyRange i-AnyRange

The indicator of the ranges of unrestricted time intervals.

BrakeParb BrakeParb

Simple trend indicator displayed in the form of NRTR.

WPRfix WPRfix

The indicator displays the price location within a specified range.