당사 팬 페이지에 가입하십시오
- 조회수:
- 16892
- 평가:
- 게시됨:
- 2019.12.05 22:13
- 업데이트됨:
- 2021.06.21 21:20
-
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동
This is a multi-asset expert adviser based on martingale trading strategy. Its original idea is taken from another expert adviser - ExpMartin available for MT4.
Warning. Martingale is easy yet very dangerous strategy. Evaluate your risks carefully.
The strategy is to open reversal trades with increased lots after every loss, until a profitable trade occured or a maximal number of reversals achieved. In both cases next trade will start with initial lot.
In comparison to the original one, this expert adviser demonstrates several points:
- conversion from MT4 to MT5 (MT4Orders and other header files are used, please find all dependencies attached);
- conversion from functional programming to OOP paradigm, which in essence makes it possible to fulfill the next objective:
- adaptation from single-symbol to multi-symbol processing;
- source code refactoring for easier reading and support;
Also some bugs were fixed.
The program can still be improved in many aspects, for example, operation by timer, volatility analysis, etc. are left out of consideration.
Input parameters
Specific symbol settings - used for step by step optimization on every work symbol (should be selected as current chart symbol).
- UseTime - enable/disable new trades opening according to the range of hours [HourStart..HourEnd];
- HourStart - starting hour of the range when new trades are allowed; takes effect if only UseTime is true;
- HourEnd - ending hour of the range when new trades are allowed; takes effect if only UseTime is true;
- Lots - initial lot size;
- Factor - multiplication factor for increased lots;
- Limit - maximal number of multiplications, if reached - initial lot is used;
- StopLoss - distance to stoploss in points (no automatic pip adjustement);
- TakeProfit - distance to takeprofit in points (no automatic pip adjustement);
- StartType - trade type for starting order: o - buy, 1 - sell;
Common settings - used for trading.
- Magic - expert id;
- SkipBadTime - an option to wait predefined period of time after trading errors (such as "not enough money", "lost connection" etc);
- WorkSymbols - a string of work symbols and their specific settings, which should be selected after separate optimizations per every symbol; the settings for symbols are separated by semicolon; the format is "name±lots*factor^limit(sl,tp)[start,stop];...", for example "EURUSD+0.01*2.0^7(500,500)[2,22];AUDJPY+0.01*2.0^5(500,500)[1,21]" -- to trade EURUSD and AUDJPY starting with buying (the plus sign) of 0.01 lots, then multiplied by 2 on losses up to 7 or 5 times correspondingly, stoploss and takeprofit are all 500 points, trading window differs by 1 hour;
- Trail - a mode how to treat stop orders: none - fixed level stoploss (no trailing), break-even - trail after profit equal to stoploss size in points, straight - trail from very beginning (may end up with a loss up to the stoploss size in points, but not larger than that);
When used with multi-currency settings, it's advisable to place the expert to a chart with most liquid symbol (where ticks arrive most frequently and trading sessions are continuous), for example EURUSD. Alternatively, one can replace OnTick event handler with OnTimer and start a timer in OnInit.
Example reports
MultiMartin trade performance on EURUSD for 3 years 2016-2019
MultiMartin trade performance on EURUSD,AUDJPY,GBPCHF for 2019
![BPNN MQL Predictor Demo with library](https://c.mql5.com/i/code/indicator.png)
This is a demo indicator with BPNN neural network library ported from C++ to MQL.
![WmiFor 3.5 for MT5 (with DTW engine)](https://c.mql5.com/i/code/indicator.png)
This indicator predicts future price movements by searching for similar candle patterns in the rate history.