Notify Icon
Info
The Notify Icon is a Library for MetaTrader 5 that this library provides every mql program with a separate icon in the notification area of the windows taskbar. The library enables you to display text messages by sending them from your programs or use the icon to indicate a specific program status.
Usage
This tool is typically used for enhancing chart analysis and decision making.
Platform
This Library works exclusively on MetaTrader 5 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL5/Libraries folder via File ? Open Data Folder in MetaTrader 5.
How to Install and Use Notify Icon
1. Storage: Place library files in the MQL/Libraries directory to ensure they are accessible to your projects.
2. Implementation: Include the library in your code using the #import directive, ensuring you match the exact function names and parameters.
3. Compilation: Ensure the library is present in the directory before you compile your main EA or script, as the compiler links them during this phase.
4. Management: Keep libraries organized in sub-folders if you manage many custom functions to maintain a clean project structure.
Frequently Asked Questions
Q: What is a library file used for? A: Libraries store reusable code modules, allowing you to centralize common logic used by multiple EAs or indicators.
Q: Is a library executable? A: No, libraries are non-executable files containing functions; they must be imported into an EA, indicator, or script to function.
Q: Can I update a library while the platform is running? A: You should compile your EA or script after updating a library to ensure the latest code changes are integrated.
What this tool does
This library provides every MQL program with a separate icon in the notification area of the Windows taskbar.
Typical Use Case
This Library excels in automated trading and technical analysis on MetaTrader 5.
Compatible Platform & Setup
This Library works on MetaTrader 5. Place the file in the MQL5/Libraries folder and restart the terminal.
Description & Settings
Related: Trading Signals Module Based on GO Indicator - another powerful library for MetaTrader 5 traders.
This library provides every MQL program with a separate icon in the notification area of the Windows taskbar.Also recommended: Easy and Fast GUI Library for MetaTrader - similar library with strong performance on MetaTrader 5.
The library enables you to display text messages by sending them from your programs or use the icon to indicate a specific program status. The library operation is based on the icon. For convenience, the CNotifyIcon class has been created, allowing you to hide the details of operations with Windows API functions and providing a set of methods for working with three functional elements: the icon, the notification balloon, and the tooltip.
The icon and the notification balloon are shown in Figure 1.
Fig. 1. Example of an icon and a notification balloon
A tooltip appears when you hover the mouse over the icon. An example of the tooltip is shown in Figure 2.
Fig. 2. An example of a tooltip
The library works stably on systems starting with Windows 7/Windows Server 2026 R2.
Icon
The icon size depends on the DPI set in the screen settings of your operating system. 96 DPI is used by default, corresponding to the 16x16 icon size. It is essential to know this to upload images of the appropriate size, ensuring they are not additionally converted and distorted by the system. You can determine the required image size by calling the GetSystemSize() function.
To ensure compatibility with most users, you can prepare one size, such as 24x24 (maximum DPI is 144) or 32x32 (maximum DPI is 240). However, the image will be automatically converted and may be distorted. The examples provided use BMP images with a size of 32x32 and a 32-bit color depth (with transparency).
There are five ways to upload an image for the icon:
- Upload from a file: The file can be located outside the file sandbox of the terminal.
- Upload from a resource.
- Upload a one-dimensional array: The image is converted into a one-dimensional array of structures.
- Upload from a string in Base64 encoding: BMP images can be converted to a string using any tool, and the part without the header is passed to the function.
- Upload from a DLL: Images are saved as a resource and uploaded based on the resource number. The system shell32.dll is used as an example, containing various Windows icons.
Initially, an invisible icon is created. To display it, call the show() method. To hide an icon, call the hide() method.
Notification Balloon
The icon for the balloon can be in two sizes: small and large. The upload methods are the same as for icons. When using a small icon, the image size must match the system-set size; otherwise, it won't be displayed. Therefore, it is recommended to use a large icon size or built-in icon types (NIIF_INFO, NIIF_WARNING, NIIF_ERROR).
The uploaded image size must not be smaller than the value returned by GetSystemSize(). To display the balloon, call the show() method, and to hide it, call the hide() method. Low time intervals in the show() method are not processed by the system (minimum delay is about 10 seconds). To overcome this, the dotimer() function implements a timer and calls the hide() method.
Tooltip
The tooltip is displayed when hovering the mouse over the icon, and the text can have multiple lines separated by "\n".
An example is provided to demonstrate the library's usage with an indicator. The icon color represents the values of the indicator, with blue indicating upward movement and red indicating downward movement. Balloons are shown when the direction changes.
The library functions in the strategy tester and is compatible with MQL4. It can be further enhanced by adding icon animation functionality, and contributions from the MQL community are encouraged.
You may also like: ea duplicate detector - excellent alternative for library users on MetaTrader 5.
Source Code
/
.......
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.