• Overview
  • Reviews (14)
  • Comments (103)
  • What's new

Double Extremum

This is a mid-term Expert Advisor based on defining two extreme points formed by indicators and comparing them to the price extreme values.


  • Start_lot – the initial lot size. If the dynamic lot is disabled (risk=0), the lot size of orders is constant.
  • risk – enable the dynamic lot with the specified risk level.
  • MaxOrders_InOneSet - the maximum number of orders in one set. 0 - no control. Allows you to flexibly limit the total number of orders, while allowing all sets to open orders (at least one at a time).
  • MaxOrders_InSymbol - the maximum number of orders for the current symbol (the sum of all sets). 0 - no control.
  • PartialCloseIfProfit_ATRs - partial closure. Close profitable orders if more than 3 orders within one set are open in the same direction and the price exceeded > PartialCloseIfProfit_ATRs.

These settings are sufficient for trading.

Expert Advisor Optimization

To improve trading, you can develop custom settings using optimization for a certain pair and write them to a plain text file:

"MetaTrader...\tester\files\DoubleExt.txt" - for testing, then copy to "MetaTrader...\MQL4\Files\DoubleExt.txt" - for trading.

The EA searches for the specified settings file and takes the basic ones from the code if none are found.

The following parameters allow configuring the EA.

  • OptimizationMode – enable/disable optimization mode. If OptimizationMode is enabled, the ForPeriod, Indicator, Ind_per, i3, i4, SL_ATRs, TPSL_koef, BreakEven_ATRs, TrailDist_ATRs, CoefExpr parameters are optimized. The best test results are placed in the specified text file (by means of a copy-paste), and from there, when the OptimizationMode is off, the EA takes the parameters when trading.
  • ForPeriod – chart period (timeframe), for which the optimization is performed.
  • Set_number – default is 0 (all sets). It is used to analyze a specific set, one of those written to the file.
  • Indicator – analyzed indicator for defining extreme values: AO, RSI, CCI, Stochastic, MACD, RVI, WPR and Momentum.
  • Ind_per – analyzed indicator period (not relevant for AO).
  • i3 – method of defining a double decreasing top. It varies from 0 to 3 (see the image below).
  • i4 – method of defining a double increasing top. It varies from 0 to 3 (see the image below).
  • SL_ATRs – initial stop loss level in the number of averaged candles. Here and further below, the size of an average candle for the tested timeframe is defined by ATR(200) indicator.
  • TPSL_coef – take profit/stop loss ratio. Recommended values are from 1 to 10.
  • BreakEven_ATRs – breakeven level in ATRs. Recommended values are from 1 to 10.
  • TrailDist_ATRs – trailing distance in ATRs. Recommended values are from 1 to 10.

If BreakEven exceeds TrailDist, trailing does not start till the price breaks the BreakEven level. In other words, BreakEven restrains trailing.

If BreakEven is less than TrailDist, an order is moved to breakeven when the price reaches the BreakEven level. This level remains unchanged till the price breaks the TrailDist level. After that, the trailing starts.

  • Coef_expr - expressiveness of the double extremum - the ratio of the lowest High to Low, to start the pattern validation. The smaller the coefficient, the more expressed the pattern and the less likely it is to be found. Recommended optimization range: from 0.55 to 0.95. Default is 0.95.
  • ShowProfitInfo – show/hide data on the EA's current trading results.

After optimization and analysis, select the most suitable test results and copy paste them to the text file. Enter a currency pair name, at which a certain result has been achieved, at the start of each line in the file (for example, "eurusd") and press TAB (mandatory). These will be the sets, each of them working according to its own parameters. After optimization, save the file.

Set OptimizationMode=false, and the EA is ready to trade according to your settings. The video is attached below.

Find the additional description here (in Russian).

Happy Trading!

ZHE WEI 2018.04.20 04:28 

Some parameter like maxorders_in symbol can not fullfill the normal functionality. and now i face the opened deals which exceed more than the maxorders paramter under this symbol.

update 20/Apr

I am satisfied with current status of this ea, and i suggest edit the parameter from the file and run from it, it can be defined by yourself and you can get a stable curve for the long term with more profit and low dd, and another idea is combine with some currency but not run on only one currency, this is also a way to avoid the risk. I think the ea belong to those one who know it and have ability to customerized it. I change the star to 5.

Hassan Raza Syed
Hassan Raza Syed 2018.04.04 23:01 

Among all this recent negativity about the EA, I for one want to say that I am more than content with the strategy and performance of the EA. And I am not saying this based on any hunch but based on very thorough back-testing of the EA and forward testing results thus far. And yes, I am not using the in-built (coded settings) for any of the pairs. Those settings are not bad but have relatively higher draw down and lower ratio of profitable trades for my taste. I have spent hours and days optimizing to find customized settings that suit my risk/reward comfort zone.

As the author has stated, the EA offers a lot of customization parameters which can be tuned to anyone taste an trading preferences. They can be optimized to find sets that have very low draw-down or very high ratio of profitable trades or less frequency (more accurate) trades of course at the cost of lower profitability. Or if one desires, highly profitability sets can be optimized but of course usually with increased risk / draw-down.

Those complaining about too many / frequent trades should consider optimizing sets on higher TFs or with lower values of Coef_expr parameter. I wouldn't recommend using the parameters MaxOrders_InOneSet or

MaxOrders_In Symbol for this purpose as they might reduce the profitablilty grately without bringing too reduction in DD.

Finally, all EAs which have a proper trading strategy (not scalping or grid/martingale EAs etc.) do normally have short periods of flat or negative equity growth (this can be seen in back test results as well) but settings which are optimized and profitable on both long term + short term back tests should recover on positive growth trend in a matter of time. Trading multiple pairs with optimized sets having low correlation does take care of this well!

Sebastian Burger
Sebastian Burger 2018.04.02 13:36 

The EA unfortunately has got a very large DD - it opens 30-40 orders when using all pairs recommended. 70% of the trades are running deep into minus, the positive ones are way smaller. Blew my whole account with the standard settings. Either use it with just 1 or 2 pairs or don't use it at all. Won't recommend it any further

Serafin Perez
Serafin Perez 2018.03.22 17:15   

Sinceramente, no me gusta este ea. No lo voy a catalogar con una puntuación de estrellas, pero no me ha dado buenos resultados a mi particularmente.

GOT.IT 2018.03.21 03:02 

EA idea is good but too much DD. Some dependence on broker. Will update my review with time.

Update 21/03/2018: Lost 80% of my deposit :(

Aussie_Trader 2018.03.20 02:22 

Thanks to Frank B for recommending this EA. Hard to find a really good EA that holds positions medium term and makes steady profits without stressful DD. This EA seems to fulfill that role admirably. Its early days on the live accounts but so far so good. See my comment #44

Update 19/3/18: Apologies to all my good friends who bought this EA. Last couple of days I have had to perform rescue mission using my good friend Trend Magnete. It appears EA has been optimized using last 5 years but in the real it can be quite schizophrenic in terms of the order flow - I plan to use this EA with max orders 3 at H4 Support & resistance levels. Risk = 1. I see that there may be some potential for that. Take Profit will be next S&R level with Trailing Stop Loss to capture and protect profit. If the trade starts to go bad - switch on the "save my ass" EA - Trend Magnete

Brendan Lu
Brendan Lu 2018.03.19 12:09 

High Risk trading needing frequent manual and/or semi-automated saving of large DD positions, STAY AWAY!

Cristobal Giron
Cristobal Giron 2018.03.19 11:46 

User didn't leave any comment to the rating

Eduardo Zuloaga
Eduardo Zuloaga 2018.03.19 11:41 

User didn't leave any comment to the rating

kyoyingmu 2018.03.19 06:05 


ygwbd123 2018.03.19 02:36 

If your account is less than 5000,then this EA will blown up your account soon or later! This EA is more dangous than martingle for small account!

Zhigang Wen
Zhigang Wen 2018.03.06 13:58 



但结果可能并不快。 有时候没有利润,但最终赚到好钱。

Carl Tilley
Carl Tilley 2018.02.27 23:32 

Superb EA. Backtests and forward tests match, drawdown acceptable if you're not too greedy with an amazing potential for profit using all the pairs on an excellent risk/reward ratio. Been using for a few weeks and already 10% up. Creator is quick to respond and genuine, also a bargain price for such a good product. A+

Samir Gonzales
Samir Gonzales 2018.02.10 08:57 

Excellent product!!! Recoup self in 2 weeks, for a month + 65% at the depo :)

Version 2.8 - 2018.04.13
1) Improved the MaxOrders functions;

2) Added the MinDist_ATRs variable, which allows setting the minimum distance between orders in the same direction;

3) Added the BreakEven_ShiftPoints variable, which allows setting a breakeven equal to the opening price +/- [BreakEven_ShiftPoints] points.

4) The MagicNumber parameter is now available for editing.

5) Added the ECN variable (for certain account types, not necessarily for all ECN). Enabling the ECN mode allows opening orders without predefined TP and SL, and to modify them after the order is placed;

6) Expanded the customization of the information panel color scheme, set a transparent background;

7) Moved additional data to the information panel:
- Information on the number of trades;
- Information of the lot calculation;
- Information on MaxOrders settings;
- Information on MinDist and ClosePart.

8) Now, the information on the number of opened orders is displayed next to each set in the list. IF a set is only working for closing, «(Х)» is displayed.

9) If the minimum lot size allowed by the broker is more than twice the manual or calculated dynamic lot, orders will not be opened.
Version 2.7 - 2018.01.29
Fixed operation of functions: MaxOrders_InOneSet, MaxOrders_InSymbol, PartialCloseIfProfit_ATRs.
Version 2.6 - 2018.01.23
1. Improved the algorithm for determining the extremums
2. The following parameters have been added:

The maximum number of orders in one set. The default is 0 (no control). Allows you to flexibly limit the total number of orders, while allowing all sets to open orders (at least one at a time). Thus, the balance of all strategies is ensured (diversification effect).

The maximum number of orders for the current symbol (the sum of all sets). The default is 0 (no control).

Expressiveness of the double extremum - the ratio of the lowest High to Low, to start the pattern validation. The smaller the coefficient, the more expressed the pattern and the less likely it is to be found. Recommended optimization range: from 0.55 to 0.95. Default is 0.95. In the earlier versions, this parameter had been hardcoded to 0.95.

Partial closure function. Close profitable orders if more than 3 orders within one set are open in the same direction. In earlier versions, the parameter was hidden. The closure of the most profitable order is triggered if the conditions are met:
- PartialCloseIfProfit_ATRs >0;
- the number of orders of one set opened simultaneously and in the same direction is greater than three;
- the distance of the most profitable order exceeds ATR*PartialCloseIfProfit_ATRs.

Version 2.5 - 2017.12.29
1. Improved display of information panel.
2. The names of the configuration files are supported: DoubleExt.txt (as in the description), Double Extremum.txt (the file name in the Market).