Mastering MQL4 Program Properties: The `#property` Directive and Why It Matters for Your Trading Setup
Camovia Tray Team · 2026-09-17
The first time you compile a new Expert Advisor or custom indicator in MetaEditor, you might not pay much attention to those odd lines sitting at the top of the code—lines that begin with #property. It’s easy to treat them like boilerplate, the equivalent of a legal disclaimer you scroll past without reading. But one day, you’re deep in the code, and your indicator stubbornly refuses to display correctly. Or you’re running a script, and it keeps executing without asking for the input parameters you painstakingly set up. That’s the moment you realize these aren’t mere formalities—they’re the essential instructions that tell the MetaTrader platform exactly how to handle your program.
In MQL4, the #property directive is a preprocessor instruction used to define specific parameters for your program before it even runs . Think of it as a set of metadata that helps the client terminal understand and service your program correctly without having to execute it first . These properties are stored in the compiled module (the .ex4 file) and guide the terminal on everything from how an indicator looks to how a script behaves . They must be declared in the main .mq4 file of your program .
For instance, if you are writing an EA, you might use #property version "1.0" to track your builds, or #property description "This is my custom moving average crossover EA" to provide a quick reminder of what the code does . These properties can be used to specify a copyright holder and a link to a company website, lending a professional touch to your work .
For indicators, #property is indispensable. It defines the visual and functional aspects of the indicator on the chart. Key properties include #property indicator_chart_window to display the indicator directly on the price chart, or #property indicator_separate_window to show it in a separate pane below . You can also specify details like #property indicator_buffers 3 to define the number of buffers used for calculation, and styling properties such as #property indicator_color1 clrRed or #property indicator_width1 2 to set the colors and thickness of the plotted lines . Without these settings, even the most advanced technical analysis logic would fail to present its results in a clear, usable way.
Scripts also benefit from specific properties. For example, using #property script_show_inputs forces the terminal to display a window with the script's input parameters before it starts running . If this property is absent, the script will simply execute with its default settings, which can be confusing when you need to adjust variables on the fly . Conversely, you can use #property script_show_confirm to display a confirmation window before the script executes, adding a layer of safety .
One of the most critical properties is #property strict. This directive enables a rigorous compilation mode that catches sloppy coding practices and common errors that might otherwise lead to bugs in your program . While it might generate a few extra warnings during compilation, using #property strict is considered a best practice that leads to more robust and reliable code . It essentially forces the MQL4 compiler to behave more like the MQL5 compiler, highlighting potential issues that could cause problems in a live trading environment .
Finally, for developers considering distributing their work, the #property tester_file, tester_indicator, and tester_library properties are essential. They define the files that need to be sent to a virtual server for strategy testing, ensuring that all custom dependencies are available when running a backtest or optimization .
Understanding and correctly implementing these #property directives is a fundamental step in your MQL4 journey. They are the bridge between your logic and the MetaTrader platform, ensuring your programs look, feel, and function exactly as intended.
This brings us to a common challenge for traders and developers alike: managing the many programs you're running. After a long session of coding and testing an indicator or a new Expert Advisor, your MetaTrader terminal is likely cluttered, competing for space on your taskbar with other essential applications. When you need to check the live quotes of the currency pair you are monitoring or quickly view the open positions of an EA, you might find yourself constantly alt-tabbing back to a cluttered terminal window.
This is where tools like Camovia Tray come into the picture. Rather than forcing you to wrestle with a crowded screen or risk someone seeing your sensitive trading data, Camovia Tray transforms your MT5 or MT4 into a sleek tray tool. You can check live quotes just by hovering over the tray icon and manage your open positions—viewing them or executing a one-click close—all from the system tray [Product Knowledge]. It allows you to hide the main MT4/MT5 window entirely, removing it from the taskbar and the Alt+Tab list [Product Knowledge]. You can even disguise the tray icon for added privacy and lock the entire tray functionality when you need to step away from your desk, knowing that all your data stays on your computer [Product Knowledge]. It provides a clean, efficient, and secure way to interact with the fruits of your MQL4 coding, letting you focus on the market without the visual noise of your development environment.
MT4/MT5 Tray Assistant
Silent tracking, one-click close - check quotes and manage positions right from the tray.
Download Camovia TrayFrequently Asked Questions
Is the MT4 bridge EA safe? What do I need to enable?
Yes. The bridge EA (CamoviaBridge) is bundled with the app - it only reads quotes/positions locally and executes close commands; no DLLs, no data uploads. Closing positions requires turning on AutoTrading in the MT4 toolbar.
How much does it cost? Is there a free trial?
Subscription pricing starts at $2.49/month (also $6.99/3 months, $13.49/6 months, $23.99/year), all plans with full features. New users get a 2-day free trial on first activation (once per device and per email), then decide whether to subscribe.
How do I restore the MT5/MT4 window after hiding it?
Choose "Show MT5/MT4" from the system tray menu and the window returns to its previous position. You can also hover the tray to check quotes and manage positions without opening the terminal.
Can it replace MT5/MT4 for trading?
No - Camovia Tray is a local shortcut tool. You can close positions right from the popup; all trading operations (opening, closing, etc.) are submitted by your local MT5/MT4 terminal to your own broker account. The app does not hold your funds or provide investment advice.
Online Tools
Popular Symbols Trading Hours
Open/close times, weekend hours & live market status:
Related Articles
How MetaTrader Expert Advisors Can Maximize Your High-Low Trailing Stop Strategy
Transform your MetaTrader EA workflow with Camovia Tray. Monitor high-low trailing stop strategies, view live quotes and open positions directly from your system tray, without opening MT4/MT5.
The MetaTrader Virus Explained: What Traders Need to Know About Security Risks
Learn what the MetaTrader virus is and how to protect your trading. Camovia Tray keeps MT5/MT4 secure with local data, privacy lock, and tray-based access.
Margin vs Leverage on Gold: What Your Broker Locks Up
Margin and leverage describe one relationship from two sides, and Camovia Tray keeps the chart, your fills and open risk visible from the system tray.
XAUUSD Trading Hours Change: Why the Same Gold Market Opens at Different Times on Your MT5
XAUUSD trading hours change by broker and daylight saving—see how Pepperstone, Vantage, and MT5 schedules differ, and how Camovia Tray helps you track gold quotes and manage positions from the system tray.
Trailing Stop on Profit: Can Expert Advisors Really Lock In Gains Without Constant Monitoring?
Discover how trailing stop on profit EAs work, their key limitation, and how Camovia Tray lets you monitor positions privately from your system tray.
More Articles
How to Filter Range-Bound Markets with the MT4 ADX Trend Filter
Discover how the MT4 ADX range trend filter helps avoid choppy markets. Use Camovia Tray to monitor ADX readings from the system tray without opening MT4.
The "MT4 to MT5 Converter" Trap: What You Actually Need to Know
Is there a real MT4 to MT5 converter? Learn the truth about account & EA migration, and how Camovia Tray bridges your workflow for easier multi-terminal management.
Gold Overnight Swap: What Holding XAUUSD Costs You
Overnight swap is the quiet cost of holding gold. See how XAUUSD swap is charged and why Wednesday is triple, and Camovia Tray keeps costs visible.
MT5 Market Watch Not Working? How to Fix It Fast
MT5 Market Watch not working or not updating? Fix missing symbols, stale quotes, and connection issues—then check quotes from the tray with Camovia Tray.
When Does XAUUSD Open in India? 3:30 AM IST Monday
XAUUSD opens about 3:30 AM IST Monday and runs to about 3:30 AM IST Saturday; the money window is the 6:30-9:30 PM IST London-New York overlap. Camovia Tray.