To improve trading, you’ll develop custom settings using optimization for a particular pair and write them to a clear text file:
“MetaTrader…\tester\files\DoubleExt.txt” – for testing, then copy to “MetaTrader…\MQL4\Files\DoubleExt.txt” – for trading.
The EA searches for the required settings file and takes the essential 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 simplest test results are placed within the specified document (by means of a copy-paste), and from there, when the OptimizationMode is off, the EA takes the parameters when trading.
period – chart period (timeframe), that the optimization is performed.
Set_number – default is 0 (all sets). it’s wont to analyze a selected set, one among those written to the file.
Indicator – analyzed indicator for outlining 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 three (see the image below).
i4 – method of defining a double increasing top. It varies from 0 to three (see the image below).
SL_ATRs – initial stop loss level within the number of averaged candles. Here and further below, the dimensions of a mean candle for the tested timeframe are defined by ATR(200) indicator.
TPSL_coef – take profit/stop ratio . Recommended values are from 1 to 10.
BreakEven_ATRs – breakeven level in ATRs. Recommended values are from 1 to 10.
TrailDist_ATRs – the 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 until the price breaks the TrailDist level. After that, the trailing starts.
Coef_expr – the expressiveness of the double extremum – the ratio of rock bottom High to Low, to start out the pattern validation. The smaller the coefficient, the more expressed the pattern and therefore the less likely it’s to be found. Recommended optimization range: from 0.55 to 0.95. The default is 0.95.
ShowProfitInfo – show/hide data on the EA’s current trading results.
After optimization and analysis, select the foremost suitable test results and copy-paste them to the document. Enter a currency pair name, at which a particular result has been achieved, at the beginning of every line within the file (for example, “eurusd”) and press TAB (mandatory). These are going to be the sets, each of them working consistently with its own parameters. After optimization, save the file.
Set OptimizationMode=false and therefore the EA is prepared to trade consistent with your settings.