Statistical criteria for selecting settings
Basic thresholds
| Parameter | Description |
|---|---|
| Statistics_1_ | The minimum profit for automatic optimization, at which configuration files are accepted. Calculated in hard currency. |
| Statistics_2_ | The maximum allowable drawdown during automatic optimization. Calculated as a percentage of the deposit. |
User criteria ( 3 - 7 )
Each group of four criteria uses the same structure: indicator selection, comparison direction, and threshold value.
_3_Statistics — user-defined criteria for setting acceptability (drop-down list). All results that do not meet the selected criteria are automatically rejected.
Available criteria are grouped into categories:
Financial indicators
| Criterion | Description |
|---|---|
| Initial deposit | The value of the initial deposit |
| Withdrawal | The amount of funds withdrawn from the account |
| Profit | Net profit at the end of testing |
| Gross profit | Total profit is the sum of all profitable trades ( ≥ 0 ) |
| Gross loss | Total loss is the sum of all losing trades ( ≤ 0 ) |
Balance drawdown
| Criterion | Description |
|---|---|
| Minimal balance | Minimum balance value |
| Maximal balance drawdown | Maximum balance drawdown in money is the largest value of all drawdowns |
| Balance drawdown percentage | Balance drawdown in % recorded at the moment of maximum drawdown in money |
| Maximum relative balance drawdown | Maximum balance drawdown in % is the largest relative value of all drawdowns |
| Relative balance drawdown percent | Balance drawdown in money recorded at the moment of maximum drawdown in % |
Equity drawdown
| Criterion | Description |
|---|---|
| Minimal equity | Minimum value of equity |
| Maximal equity drawdown | Maximum Drawdown in Cash - the largest value of all drawdowns |
| Equity drawdown percentage | The drawdown of funds in % recorded at the moment of the maximum drawdown in money |
| Maximum relative equity drawdown | Maximum drawdown in % is the largest relative value |
| Relative equity drawdown percent | Drawdown of funds in money recorded at the moment of maximum drawdown in % |
Trade series
| Criterion | Description |
|---|---|
| Maximal profit trade | Maximum profit is the highest value among profitable trades ( ≥ 0 ) |
| Maximum loss trade | Maximum loss is the smallest value among losing trades ( ≤ 0 ) |
| Maximal consecutive profit | Maximum profit in a sequence of profitable trades ( ≥ 0 ) |
| Maximal consecutive wins | Total profit in the longest winning streak |
| Maximal consecutive loss | Total loss in the longest losing streak |
| Maximal consecutive losses | Number of trades in the longest losing streak |
| Trades of maximum consecutive profit | Trades with the highest consistent profits |
| Maximum consecutive wins count | Maximum number of consecutive wins |
| Trades of maximum consecutive loss | Trades with maximum continuous loss |
| Maximal consecutive losses count | Maximum number of consecutive losses |
| Average consecutive wins | Average length of a profitable trading streak |
| Average consecutive losses | Average length of a losing streak |
Quality indicators
| Criterion | Description |
|---|---|
| Expected payoff | Mathematical expectation of winning |
| Profit factor | Profitability |
| Recovery factor | Recovery factor |
| Sharpe ratio | Sharpe ratio |
| Minimal margin level | Minimum achieved margin level value |
| On tester result | The value of the calculated user optimization criterion |
Trade statistics
| Criterion | Description |
|---|---|
| Deals | Number of completed transactions |
| Trades | Number of trades |
| Profit trades | Profitable trades |
| Loss trades | Losing trades |
| Short trades | Short trades |
| Long trades | Long trades |
| Profit short trades | Short profitable trades |
| Profit long trades | Long profitable trades |
Setting the direction and threshold
Each of the five criteria ( 3 - 7 ) uses three parameters:
| Parameter | Description |
|---|---|
| _N_Statistics | Select a criterion from the list above |
| _N_Stat | Direction of comparison: more or less . For drawdown — "less" (the less, the better). For profit factor — "more." |
| Statistics_N_ | The minimum/maximum value of the criterion at which the settings are accepted |
Parameters _4_ – _7_ similar _3_ by structure and purpose - allow you to set up to five independent selection criteria simultaneously.
Forward testing of settings during optimization
Forward — If enabled, the Expert Advisor performs forward testing directly during optimization, independent of the MT5 strategy tester. From the set date, blocks calculating profit (in the deposit currency), relative drawdown (in %), profit factor, and expected value are enabled.
Auto_Forward_Time — automatic setting of the forward testing start date. The starting point is the current date, the end point is the optimization start date (Auto_Start_Time or Start_Time ). The forward testing period is counted from this section.
| Meaning | Period share |
|---|---|
| 1/2 | 50% |
| 1/3 | 30% |
| 1/4 | 25% |
| Custom | Specified by parameter Forward_Time |
| 1–12 months | From 1 to 12 months from the current date |
Forward_Time — start forward testing if Auto_Forward_Time = 0 (Custom mode).
Threshold values for accepting settings:
| Parameter | Description |
|---|---|
| Forward_Profit | Profit in the deposit's hard currency, at which the settings are accepted |
| Opt_Drawdown | Relative drawdown in % of the deposit, within which the settings are accepted |
| Opt_Profit_Factor | Profit factor at which the settings are accepted |
| Opt_Expected_Payoff | The mathematical expectation at which the settings are accepted |
File filter with settings
Opt_Loss_Percent — drawdown calculation mode for file filtering:
| Meaning | Description |
|---|---|
| Percent_Off | Do not use the function |
| Percent_Off (second mode) | Fixed amount Opt_Loss_Del |
| Percent_Init | Percent Opt_Loss_Del from the initial deposit |
Opt_Loss_Del — automatic deletion of files that failed forward testing or that have suffered a drawdown greater than the acceptable limit. Value — maximum drawdown in % or a fixed amount (depending on Opt_Loss_Percent ). If 0 — not used.
Opt_Zero_Del - deletion of files for which there were no transactions.
Only_Forward — if enabled, only files obtained as a result of forward testing (exceeding Opt_Loss_Del ). If disabled, files are processed during pre-testing.
Automatic recording and setting of parameters
| Parameter | Description |
|---|---|
| Opt_Time | The optimization completion time is set automatically during manual optimization. It remains unchanged during automatic optimization. |
| Opt_Time_Stop | The number of days the settings are considered fit for trading from the moment Opt_Time . When it expires, trading is suspended. If 0 — not used. Used for trading without a file system. |
| Opt_Symbol | Automatically switches to the symbol for which the settings are intended. Works only when disabled. Download_Files and manual optimization |
| Opt_Period | Automatic switching to the period for which the settings are intended. Same conditions |
| Opt_Time_Set | An internal advisor parameter for automatic optimization and selection. No need to change it. |
Sending messages
| Parameter | Description |
|---|---|
| Send_Mail | Sending messages to email. Pre-configure your terminal to send email. Only critical messages are sent. |
| Send_Notification | Sending push messages to a mobile terminal. Configure the terminal first. |
| Checking_Status | Periodic messages confirming the advisor's activity are sent. Any absence of messages is a reason to check the VPS. |
| Checking_Max_Positions | If enabled, messages about opening/closing trades are sent with detailed information: number of active trades, balance, floating profit |
| Message | Free text - VPS IP or any other information for quick terminal identification |
| Pause_Time | Pause between messages in minutes |
| Send_Screen_Shot | If more 0 — publishing chart screenshots when opening/closing positions. The value is the screenshot number (to avoid duplication across multiple copies of the advisor). Requires FTP setup and your own server for file uploading. |
News filter
| Parameter | Description |
|---|---|
| Use_News | Trading pauses before news releases |
| Start_News | If enabled, the robot is activated only during news releases (news trading) |
| After_News_Stop | Trading pause before news release, in minutes |
| Before_News_Stop | Trading pause after news release, in minutes |
| News_Light | Consider news of least importance |
| News_Medium | Consider news of medium importance |
| News_Hard | Take into account the news of greatest importance |
| News_Close | Closing positions before news release |
| News_Orders_Del | Removing pending orders before news releases |
| GMT_Auto_News | Automatic time shift |
| Your_Time_Zone | Manual time shift if GMT_Auto_News = false |
Advisor dashboard
| Parameter | Description |
|---|---|
| Tab_Size | Font size of comments on the chart |
| Tab_Width_0 | Additional lining width |
| Tab_Width_1 … Tab_Width_3 | Additional indents between columns |
Controlling the Expert Advisor from the Chart during Optimization
Accountant — optimization monitoring mode. A separate instance of the advisor is launched on the chart in real time. The chart displays the number of optimized files in each folder and the number of days since the oldest file was created.
| Parameter | Description |
|---|---|
| Auto_Folder_Number | Reading the root folder number for saving files when changing from the graph |
| Auto_Magic_Number | Reading the folder number for automatic testing of received files |
Switch_Currency_Strategs - switching from the graph using the buttons:
| Meaning | Description |
|---|---|
| Switch_Off | Do not use |
| Switch_Currency | Switch currency pairs |
| Switch_Strategs | Switch strategy |
File_Sandbox — files are created in a sandbox folder before being transferred to the main folder. This allows you to test the settings for stability on the same device where optimization is taking place. Transfer is performed using the button Moving (lower right corner of the graph) in mode Accountant .
File_Delete — deleting all files from the main folder before moving files from the sandbox. Eliminates the risk of leaving obsolete files behind when changing strategies, currency pairs, periods, and other criteria.
| Parameter | Description |
|---|---|
| Get_Number | The number of rows in each table column. Depends on the monitor resolution. |
| Get_Size | Table font size in mode Accountant. Depends on monitor resolution and computer settings. |
| Get_Symbol | Checking the list of instruments: with direct recalculation (Straight) - determines which instruments of the broker are not in the list of the advisor; with reverse (Back) - which instruments from the list are not available to the broker |
| Box_Message | Confirm actions when moving/deleting files using buttons on the chart. Disabling this option speeds up the process. |
| Change_Alert | Sound accompaniment when changing, updating, adding or deleting files during optimization |
Auxiliary functions
Profit_Drawdown — a drawdown in the deposit's hard currency, in which case the row in the table is colored differently to facilitate visual analysis.
Set_Timer — generation of events from a timer with a specified frequency instead of chart ticks. If 0 — not used; generation is tick-based. Allows the advisor to operate independently of incoming ticks.
Detailed description of the parameters
- https://www.mql5.com/en/blogs/post/775377 (part 1)
- https://www.mql5.com/en/blogs/post/775378 (part 2)
- https://www.mql5.com/en/blogs/post/775379 (part 3)
- Emperor — MQL5 Market: https://www.mql5.com/en/market/product/59948
![[Action Required]: Manual EA Pause Recommended [Action Required]: Manual EA Pause Recommended](https://c.mql5.com/6/1027/splash-preview-775266.png)

