Setting up a trading advisor - a complete guide
Terminal setup
Before running the advisor, add the following URLs to the section Advisors terminal:
- https://emilon.ru
- http://ec.forexprostools.com
- https://api.telegram.org
- http://client-api.instaforex.org
- https://api.vk.com
Activating the Advisor
License (License_ID)
License key number. When purchased from the MQL5 Market, this parameter is inactive and can take any value.
Key generated automatically upon payment On the developer's website. A link to your personal page with the key is sent by email, and the key is also available in your personal account on the website.
- Named license — works on any account registered in your name (except for the demo, since the demo can be opened in any name).
- Numbered license — can be issued for any type of account, including demo.
Donation (Vk_Token)
A VKontakte social network token for verifying subscriptions to closed communities as a donor. Grants the right to use the advisor. The activation method may be unavailable.
Automatic setup (Code_Token_Subscription)
Remote reconfiguration system. Enter the configuration code or the Telegram bot token. The advisor downloads the latest settings and reconfigures itself automatically—even daily.
At rent advisor or use affiliate program The field must be empty (the service is included in the package).
Coalition of currency pairs
Choice_Coalition
Coalition mode between currency pairs:
| Meaning | Description |
|---|---|
| Coalition_Off | Not used |
| Coalition_Direct | Only a parallel coalition |
| Coalition_Cross | Also a cross-coalition |
| Coalition_All | Any coalition |
Example of a parallel coalition: EURUSD and GBPUSD share a common USD section. If the EA opens a buy trade on EURUSD, it considers a sell trade on GBPUSD. When the USD exchange rate fluctuates, the balance remains the same—one pair experiences a drawdown, the other gains.
Example of a cross-coalition: EURUSD and USDJPY. When buying EURUSD, the EA also looks for buying opportunities on USDJPY to hedge the USD.
The coalition can operate between multiple terminals on the same or different devices—via the internet using the FTP protocol (requiring additional terminal and server configuration). Within a single terminal, simply enabling the function is sufficient.
Symbol_Coalition
The data processing queue number (from 1 to 10) for exchange between terminals. At each subsequent terminal, the number must be one higher than the previous one. If this number is interrupted, the processing chain is interrupted.
Automatic selection of files with settings
Auto_Selection
| Meaning | Description |
|---|---|
| Drive_Off | Not used |
| Drive_Selection | Automatic file selection |
| Drive_Turbo | Turbo mode with all files included |
In turbo mode, the advisor operates on a carousel principle—it cycles through all available file folders and is capable of opening multiple positions in different directions on different pairs.
Selection_Profit
A fixed amount for the forward testing report sheet, below which configuration files are not accepted for selection.
Selection_Time
File upload order: 1 — the leader (the countdown starts from him and is reset on him), then 2 , 3 , 4 ... to 60 .
This is needed to distribute files between advisors in different terminals. If the first robot (leader) accepts settings #10, the next terminal starts with #11, and so on.
Server file download manager
DS_Server
| Meaning | Description |
|---|---|
| Server_Off | Not used |
| Download_Server | Automatic download of files from the developer's server (code needed in Code_Token_Subscription (reset every 3 hours) |
| Send_Server | Send files to your server via FTP for subsequent download by an advisor from anywhere in the world |
Any user can download files from your server - just specify the server address in the terminal settings and the code in Code_Token_Subscription. The code is generated automatically when the strategy tester is launched in optimization mode; codes are not repeated. This allows you to set up a paid subscription to settings files.
Broker_TF
Periods available for download: all existing in the terminal or a specific one. PERIOD_CURRENT periods are sorted taking into account the parameter Period_TF , otherwise - one specified period (search is faster).
Period_TF
A filter for selectively downloading settings by period. This saves time—otherwise, the robot tries to download files for all periods. Periods are specified by separating them with a slash:
1=M1, 2=M5, 3=M15, 4=M30, 17=H1, 20=H4, 24=D1, 25=W1, 26=MN, 10=M2, 11=M3, 12=M4, 13=M6, 14=M10, 15=M12, 16=M20, 18=H2, 19=H3, 21=H6, 22=H8, 23=H12
At the same time Broker_TF must be equal PERIOD_CURRENT .
Broker_List
Search for symbols to load: from the broker's offerings or from a specified list. Local search reduces search time. Pairs are specified by separating them with a slash:
EURUSD/USDJPY/USDCHF/GBPUSD/USDCAD/ NZDUSD/AUDUSD/EURGBP/EURCHF/EURJPY/ AUDCAD/CADJPY/CADCHF/AUDCHF/AUDNZD/ EURCAD/EURAUD/NZDJPY/EURNZD/GBPJPY/ NZDCHF/GBPNZD/GBPCHF/NZDCAD/AUDJPY/ CHFJPY/GBPAUD/GBPCAD/XAUUSD/XAGUSD/
Loading files into the advisor parameters
Auto_Set
When enabled, the Expert Advisor creates and loads settings files upon startup. Disable this option if you don't want to trade with the preset settings (they are primarily intended for demonstration purposes in the strategy tester and become outdated over time).
Download_Files
Trading with a file-based settings system. The robot is launched on a single chart, and trading is conducted in multi-currency mode—usually from 1 to 30+ pairs (maximum 201 pairs included). The robot prevents deposit overload and can operate from $100.
Symbol_Filter
When turned on, the robot loads settings only for pairs from the list Broker_List . The list can be modified, separators are required. / .
The more pairs, the higher the load on the terminal and computer/VPS. When running 10+ terminals, make sure the server can handle it. If not, the advisors will be forcibly unloaded, but when you return to the charts, they will reliably find their positions and continue monitoring them.
Hierarchy of settings files
Structure: Group ( Folder_Group ) → Strategy ( Folder_Number ) → Settings ( Magic_Number ) → File number ( Expert_Number ).
| Parameter | Purpose |
|---|---|
| Folder_Group | Folder group (A, B, C... Z). Combines combinations of settings with different signal filters. |
| Folder_Number | The number of the folder containing the files. This is set during optimization and is used to search for the set. |
| Magic_Number | Position identifier and initial subfolder number. Set during optimization; subsequent folders are numbered in ascending order. |
| Expert_Number | Advisor ID to distinguish positions when running multiple copies in one terminal |
Different_Magic
When enabled, position identifiers are not repeated: to Magic_Number the file's serial number is added, for example (1)1 , (1)2 , (1)3 ... Magic_Number acts as a prefix.
Important: parameter Different_Magic incompatible with TotalPass - when optimizing with TotalPass The file order is not respected and the robot will lose control over a number of positions. To disable TotalPass set it equal to zero.
Blocking and deleting obsolete files
| Parameter | Description |
|---|---|
| Delete_File | When turned on, the robot deletes files older than Max_Time_File days (from the optimization completion date). Files cannot be overwritten—they are deleted manually, automatically upon expiration, or updated from the server. |
| Max_Time_File | Files expire in days. After this period, opening of initial positions is suspended, averaging continues until all series are closed, and then trading ceases. 0 — not used |
Allocation of funds and risk limitation
Basic parameters
| Parameter | Description |
|---|---|
| Account_Balance | If > 0, the virtual balance is used for lot calculations and loss limits; otherwise, the real balance is used. Useful when running multiple copies of the advisor on a single account. |
| History_Datetime | Calculates profit/loss for a specified number of days (e.g. 30 for the last 30 days). The value is added to Virtual_Account_Balance . 0 — not used |
| Minimum_Account_Balance | Minimum funds for trading. If the balance is lower, trading is suspended until a deposit is made. 0 — not used |
| Stop_Trade_All | When turned on - when the balance falls below Minimum_Account_Balance All pairs are blocked; otherwise, only the pair for which the virtual balance has fallen below the threshold is blocked. Only works when Minimum_Account_Balance > 0 |
Stop Loss on a Single Pair
| Parameter | Description |
|---|---|
| Total_Balance_Risk_One | The percentage of drawdown at which all positions with the specified values are closed Expert_Number And Magic_Number . 0 — not used |
| Broker_Stop_Loss | When enabled, the stop loss is fixed on the broker's side and is adjusted when opening new positions so that the total loss does not exceed the specified percentage. |
Stop Loss on All Pairs
| Parameter | Description |
|---|---|
| Total_Balance_Risk_All | The percentage of drawdown from the real balance at which all positions with the specified balance are closed Expert_Number . 0 — not used |
| Mode_Balance_Real | When enabled, the calculation is based on the real balance, otherwise - on the virtual one Account_Balance |
Advisor blocking in case of dangerous deposit decrease
| Parameter | Description |
|---|---|
| Total_Close_Stop | The number of losing streaks after which the advisor is blocked. 0 — not used |
| Total_Close_Risk | The percentage of the deposit at which the series is considered critically unprofitable when closed |
| Stop_Time_Reset | Reset data and unlock by time (in hours). 0 — not used |
| Balance Reset | Unblocking upon balance replenishment. false — not used |
| New_Files_Update | Unlock when updating settings files (expiry date less than 24 hours). false — not used |
There's also a manual reset button on the chart. Restarting the terminal doesn't reset the data.
Trading history analysis and blocking
| Parameter | Description |
|---|---|
| Trade_Loss_History | Number of losing trades per period Select_Loss_History , after which trading is suspended. It resumes when trades become stale and are no longer counted. |
| Select_Loss_History | The period for accounting for unprofitable transactions in days (for example, 30 - transactions older than 30 days are not taken into account) |
| Stop_All_Symbol | When enabled, if the loss limit for any symbol is exceeded, all pairs are blocked. |
| Stop_All_Magic | When enabled, position analysis is performed without taking into account identifiers. |
Limiting the number of pairs traded simultaneously
Count_Symbol_Max
The number of pairs traded simultaneously taking into account Count_SMT . Calculated by currencies, not by positions: 2 positions for EURUSD + 3 for GBPUSD = 2 pairs.
Count_SMT
| Meaning | Accounting |
|---|---|
| Count_Symbol | By symbol |
| Count_Symbol_Magic | By symbol and magician |
| Count_Symbol_Magic_Type | By symbol, magician and type |
Synchronous_Trading
When working with multiple copies in one terminal: when disabling a position Count_Symbol_Max are counted separately (taking into account Expert_Number ), otherwise - together.
Control of the number of positions
| Parameter | Description |
|---|---|
| Count_Trades_Symbol_Max | A limit on positions for one pair, after which trading on other pairs is suspended until the drawdown series is closed. |
| Control_Positions | Identification of positions based on the "friend or foe" principle. When critical parameters change ( Expert_Number , Magic_Number (or excluding pairs) unrecognized positions are displayed in red, and trading is suspended until they are closed. Works in conjunction with Count_Trades_Symbol_Max |
Blocking new series during drawdown
- Drawdown_Max — a drawdown as a percentage of the deposit, above which the opening of new positions (except averaging ones) is suspended.
Distance between positions
| Parameter | Description |
|---|---|
| Dist_Price | Minimum distance between first positions regardless of identifiers |
| Dist_Price_After | Compliance Dist_Price for second and subsequent positions |
Control of trade direction
- Direction_Control — when enabled, the robot does not open opposite positions for one pair, taking into account the identifier.
Early exit from the market
| Parameter | Description |
|---|---|
| Max_Total_Exit | The maximum number of positions, upon reaching which the advisor closes the series with a profit Exit_Profit |
| Exit_Profit | Profit size for early closure when triggered Max_Total_Exit |
| Exit_Range | When turned on, automatic setting of optimization values (start/step/stop) |
| Exit_Total_Range | Optimization values for Max_Total_Exit through / (For example, 7/1/10 ). Only with Exit_Range And Auto_Set_Default |
| Exit_Profit_Range | Optimization values for Exit_Profit . Only with Exit_Range And Auto_Set_Default |
Money management
| Parameter | Description |
|---|---|
| Risk | If > 0, the lot is automatic. Formula: Risk = (Risk += Lot) for each balance gradation. For example, Risk=100, Lot=0.01 : $100 → 0.01, $200 → 0.02, $300 → 0.03 |
| Lot | If Risk=0 - fixed lot, otherwise it is calculated automatically |
| Lot_Exponent | Lot multiplication coefficient for averaging positions |
| Max_Lots | Maximum lot; when reached, it stops multiplying and is fixed |
| Lot_Exponent_Range | Optimization values for Lot_Exponent . Only with Auto_Set_Default |
Spread and slippage
- Max_Spread — the maximum allowable spread.
- Max_Slippage — maximum permissible slippage.
Take profit
Market take profit
| Parameter | Description |
|---|---|
| Take_Profit | Market take profit. 0 — not used |
| Take_Profit_Range | Optimization values for Take_Profit . Only with Auto_Set_Default |
Virtual take-profit/stop-loss
- Virtual_TP_SL — when enabled, stop-loss and take-profit are stored in the advisor's memory and are not transmitted to the server.
- Close_Inverse - closing opposite positions along with the directed ones upon reaching SL/TP. Only with Virtual_TP_SL .
Market stop-loss
| Parameter | Description |
|---|---|
| Stop Loss | Market stop loss. 0 — not used |
| Stop_Loss_Range_Set | Flag for enabling automatic setting of optimization values |
| Stop_Loss_Range | Optimization values for Stop_Loss . Only with Auto_Set_Default |
Averaging positions
| Parameter | Description |
|---|---|
| Martingale | Averaging positions |
| Dynamic_Pips | Dynamic distance between positions |
| Default_Pips | Fixed distance (if Dynamic_Pips turned off) |
| Depth_History | History depth for dynamic distance calculation |
| Sep_Channel | Dynamic distance division factor |
| Max_Trades | Maximum positions for each individual strategy |
| Limit_Orders | Maximum positions in the terminal (total number, regardless of identifiers) |
| Max_Trades_Range | Optimization values for Max_Trades . Only with Auto_Set_Default |
Early closure by time
| Parameter | Description |
|---|---|
| Expiration_Seconds | When turned on, the lifetime is in seconds, otherwise in hours |
| Max_Trade_Open | Position lifetime. Minimum: 660 seconds; for shorter values, a 660-second request is sent to ensure broker-side closure + an internal countdown for forced closure. |
| Min_Profit | Minimum floating profit to close at expiration. Can be negative. |
| Exp_Time_Prof | Decrease permission flag Min_Profit for frozen positions |
| Exp_Time_Prof_Max | Maximum reduction factor Min_Profit . For example: Min_Profit=-10%, Max_Trade_Open=24h, coefficient=2 → after 48 hours the threshold will be -20%, and will not decrease further |
| Exp_First_Break | When enabled, expiration is calculated from the last position; otherwise, it's calculated from the first. This has a dramatic impact on trading. |
| Max_Trade_Open_Range | Optimization values for Max_Trade_Open . Only with Auto_Set_Default |
| Min_Profit_Range | Optimization values for Min_Profit . Only with Auto_Set_Default |
Trading session time
| Parameter | Description |
|---|---|
| Open_Hour / Open_Min | Hour and minute of the session start |
| Close_Hour / Close_Min | Hour and minute of session end |
| Your_Time_Zone | Manual time shift. If you trade with the same broker whose quotes the EA was optimized on, 0 . Otherwise - shift to fit the optimization broker's server time |
Example: The advisor is optimized for RoboForex (17:00), and for the current broker it’s 20:00 → a shift of -3 hours.
| Parameter | Description |
|---|---|
| Trade_Wednesday | Wednesday Trading (Triple Swap Day) |
| Trade_Friday | Trading on Friday (before the end of the week) |
| Trade_End_Year_Month | Trading on the last day of the month and 7 days before the New Year |
| Open Hour Range | Optimization values for Open_Hour . Only from Auto_Set_Default |
| Close_Hour_Range | Optimization values for Close_Hour . Only from Auto_Set_Default |
| Use_Min_Profit_Close | When enabled, early closure taking into account Min_Profit ; otherwise, with the current profit (including negative), which may lead to unjustified losses |
| Close_Time | Closing positions after the session taking into account Min_Profit - to avoid large losses when closing hastily |
| Friday_Close | Early closing on Friday taking into account Use_Min_Profit_Close |
Trailing stop
| Parameter | Description |
|---|---|
| Use_Trailing_Stop | Trailing_Off — not used; Trailing_On_2 - without transfer to breakeven; Trailing_On_4 — with transfer to breakeven |
| Open_Bar_Trailing | Trailing only at opening prices |
| Price_Next_Bar | Trailing starts after the current bar closes (only in the mode Trailing_On_2 ) |
| Trail_Start | Start of trailing stop |
| Trail_Stop | Trailing stop step |
| No_Loss | Transfer to breakeven (only Trailing_On_4 ) |
| Min_Profit_No_Loss | Breakeven level (only Trailing_On_4 ) |
| Trailing_Range | Flag for auto-setting optimization values for Trail_Start And Trail_Stop |
| Trail_Start_Range | Optimization values for Trail_Start . Only with Auto_Set_Default |
| Trail_Stop_Range | Optimization values for Trail_Stop . Only with Auto_Set_Default |
Order type
Order_Type
| Meaning | Description |
|---|---|
| Buy_Sell | Urgent positions (market) |
| Buy_Sell_Stop | Stop Pending Orders |
| Buy_Sell_Limit | Pending Limit Orders |
Order_Price
Price for placing pending orders:
- (Ask/Bid +-) Order_Distance — current price ± distance
- (Fractal +-) Order_Distance — fractal price ± distance
- (ZigZag +-) Order_Distance — zigzag price ± distance
Additional order parameters
| Parameter | Description |
|---|---|
| Order_SL_Moment | Instant stop-loss placement along with a pending order; otherwise, only after triggering |
| Dist_Price_Modify | Constant modification of pending orders following the price (for news trading) |
Distance of pending orders
| Parameter | Description |
|---|---|
| Order_Distance | Distance from the target price for placing orders |
| Min_Dist_Order_History | Prohibition of re-installing orders at broken levels for N days. 0 — not used |
| Auto_Set_Distance | Flag for auto-setting optimization values for Order_Distance |
| Order_Distance_Range | Optimization values for Order_Distance . Only with Auto_Set_Default |
Indicators
Fractals
- Fractal_Count — fractal index.
Zigzag
| Parameter | Description |
|---|---|
| Inp_Depth | Depth indicator |
| Inp_Deviation | Indicator deviation |
| Inp_Step | Step indicator |
Deleting pending orders
By time
| Parameter | Description |
|---|---|
| Order_Time_Seconds | When turned on, the lifetime is calculated in seconds, otherwise in hours |
| Order_Time | Lifetime of pending orders |
| Auto_Set_Time_Seconds | Flag for auto-setting optimization values for Order_Time |
| Order_Time_Range | Optimization values for Order_Time . Only from Auto_Set_Default |
According to the terms
| Parameter | Description |
|---|---|
| Del_Orders_Time | Deletion after the end of the trading session |
| Del_Orders_Spread | Removal when the maximum spread is exceeded |
| Del_Orders_Signal | Removal upon return signal from indicator block |
| Del_Orders_Level | Deletion when changing the extreme level of a fractal or zigzag |
Important note
Parameters marked with asterisks (***) are changed when loading settings files. The remaining parameters are personal and are changed at the user's discretion. Personal parameters do not affect the quality of transactions, but they can change the deposit load.
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 Expert Advisor page in MQL5 Market
- 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)

