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.
Popular Symbols Trading Hours
Open/close times, weekend hours & live market status:
Related Articles
The Essential MT4 Keyboard Shortcuts List: Trade Faster, Smarter, and with Less Distraction
Master MT4 keyboard shortcuts to trade faster, plus discover how Camovia Tray turns your terminal into a tray tool for quick quotes and position checks—without keeping MT4 on screen.
MT5 vs MT4 Trading for Beginners: Which Platform Should You Start With?
Discover MT5 vs MT4 for beginners: which platform fits your trading style? Learn key differences and how Camovia Tray turns either into a quiet tray tool that keeps live quotes and positions at your fingertips—without keeping the terminal open.
Beyond the Market Watch: How to Really Show All Symbols in MT5
Discover how to show all symbols in MT5 and streamline your workflow. Camovia Tray lets you monitor live quotes from the system tray—fast, private, and secure.
MT4 vs MT5 Explained: Clearing Up the Confusion (And Why It Matters for Your Trading Setup)
Discover the real differences between MT4 and MT5 beyond the myths. Learn which platform fits your trading style and how Camovia Tray turns either terminal into a discreet tray tool for instant quotes, position management, and local data privacy—without replacing your favorite platform.
Is There an MT5 EA for Gold Scalping That Actually Works?
Discover if MT5 EAs for gold scalping truly work, why backtests mislead, and how Camovia Tray helps you monitor positions & spreads from the system tray.