Expert Advisors versus Indicators: Core Distinctions
Expert Advisors are mechanical trading systems that automate both analysis and order execution. They continuously monitor market conditions, generate trading signals, and place or manage positions without manual intervention. In contrast, custom indicators are analytical tools designed solely for processing price data and identifying patterns. Indicators cannot initiate trades or interact with the trade server; they only provide visual or numerical outputs on a chart. According to the platform documentation, indicators may be used inside Expert Advisors to form a complete automated trading system, but they remain subordinate to the robot’s logic.
The distinction is further clarified by the storage locations within the file system. Expert Advisors reside in the /MQL5/Experts folder, while indicators are stored in /MQL5/Indicators. This separation reflects their intended roles: one executes trades, the other analyzes prices. When attached to a chart, an Expert Advisor appears in the upper right corner with an icon that indicates whether trading is permitted. An indicator, however, occupies a separate window or overlays the price chart without any trading controls.
Sources: MetaTrader 5 documentation: robots MetaTrader 5 documentation: automation
Attachment Points and Chart Interaction
An Expert Advisor can only run on a single chart at a time. If a second Expert Advisor is launched on the same chart, the first one is automatically removed. This limitation ensures that each chart hosts exactly one trading robot, preventing conflicting instructions. The attachment process is initiated by double‑clicking the Expert Advisor in the Navigator window or by dragging and dropping it onto the desired chart. Once attached, the Expert Advisor Properties dialog appears, allowing the user to configure parameters before activation.
Indicators, on the other hand, have no such restriction. Multiple indicators can be applied to the same chart simultaneously, each rendering its own visual representation. They do not occupy a dedicated slot like Expert Advisors; instead, they overlay the price series or display in separate sub‑windows. Because indicators lack trading capabilities, they do not require exclusive chart ownership. This design allows traders to stack several analytical tools for comprehensive market evaluation without interference.
Sources: MetaTrader 5 documentation: robots MetaTrader 5 documentation: automation
Permissions and Automated Trading Controls
Automated trading is governed by two layers of permissions: global platform settings and individual Expert Advisor properties. At the platform level, the AutoTrading button on the toolbar enables or disables automation for all Expert Advisors. When disabled, no robot can execute trades even if its individual settings allow it. Conversely, if the global toggle is enabled, each Expert Advisor may still be restricted by its own Allow Auto Trading option. This dual‑control mechanism prevents unintended trading during testing or when switching accounts.
Individual control is also available via the Navigator window, where each running Expert Advisor is listed with an icon indicating its trading status. Right‑clicking an entry provides commands to enable or disable trading for that specific robot. Additionally, the platform offers protective options such as disabling automated trading when switching accounts, profiles, chart symbols, or periods. These safeguards ensure that robots do not activate under conditions the user did not anticipate, such as moving from a demo to a live environment.
Sources: MetaTrader 5 documentation: robots MetaTrader 5 documentation: automation
Execution Flow and Re‑initialization
When an Expert Advisor is first attached, its OnInit function runs once to initialize variables and perform preliminary checks. Subsequently, the OnTick function executes on every new tick, processing price updates and potentially generating trade actions. If the user modifies input parameters while the robot is running, the properties window cannot be opened during execution. Changes are only applied between OnTick calls, at which point the Expert Advisor is re‑initialized with the new values. This ensures that parameter adjustments take effect cleanly without interrupting the current processing cycle.
Indicators follow a similar but distinct lifecycle. Their OnCalculate function is called whenever new price data arrives or when the chart is refreshed. Unlike Expert Advisors, indicators do not have access to trading functions, so their output is limited to plotting lines, histograms, or numerical values. Because they cannot trade, indicators do not require the same permission checks as Expert Advisors. However, they still respect the global AutoTrading setting insofar as disabling automation does not prevent indicators from calculating and displaying results.
Sources: MetaTrader 5 documentation: robots MetaTrader 5 documentation: automation
Security Implications and External Dependencies
Expert Advisors may import functions from external DLLs through the Dependencies tab. Enabling DLL imports extends functionality but introduces potential security risks, as malicious libraries could execute arbitrary code. The platform therefore requires explicit consent for each Expert Advisor, with an option to allow or block DLL usage. If the Allow DLL imports checkbox is disabled and the robot attempts to load a DLL, the OK button in the properties window disappears, preventing execution. This default restriction encourages users to verify the source of any Expert Advisor before granting access.
Similarly, Python scripts that interact with the trading platform must have automated trading explicitly enabled via the Disable automated trading via external Python API option. By default, this setting is active, blocking any trading operations initiated by Python code. Only when the user unchecks this option can Python scripts execute trades. These layered security measures ensure that both MQL5 and external Python integrations require deliberate authorization before affecting live positions.
Sources: MetaTrader 5 documentation: automation MetaTrader 5 documentation: robots
AI-assisted educational article. Automated checks reviewed source support and quality; they do not guarantee accuracy. This is not investment advice. Leveraged and automated trading involves substantial risk of loss.
Sources & further reading
MetaTrader 5 documentation: robotsMetaTrader 5 documentation: automationEducational content only. This article is not investment advice. Automated and leveraged trading involves substantial risk of loss.