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 to 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: Benchmark - 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. The library enables you to display text messages by sending them from your programs, or to 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 to hide the details of operations with Windows API functions and providing a set of methods for working with three functional elements, including the icon, the notification balloon and the tooltip.
Also recommended: GRat Order Exchange - similar library with strong performance on MetaTrader 5.
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.</t1>
Fig. 2. An example of a tooltip
The library works stably on systems starting with Windows 7/Windows Server 2008 R2.
Icon
The icon size depends on DPI set in the screen settings in your operating system. 96 DPI is used by default, which corresponds to the 16x16 icon size. You need to know this in order to upload images of the appropriate size. In this case, your images will not be additionally converted by the system and, therefore, will not be distorted. It is not possible to upload an image of a smaller size.
You can find out the required image size by calling the GetSystemSize() function.
In order to not to create images for every DPI value, you can prepare one size, say 24x24 (maximum DPI is 144) or 32x32 (maximum DPI is 240). Thus you can ensure compatibility with most users, but in this case the image will be automatically converted (size will be reduced) and can therefore be distorted. The examples show images in BMP with a size of 32x32 and a 32-bit color depth (with transparency).
There are five ways to upload an image for the icon:
The first and most obvious way is to upload from a file. In this case, the file can be located outside the file sandbox of the terminal.
The second way is to upload from a resource.
The third way is to upload a one-dimensional array. Within this method, an image is preliminary converted into a one-dimensional array of structures.
The fourth way is to upload from a string in Base64 encoding. BMP images can be converted to string using any . The part of the string without the header (shown in red) is passed to the function:
The fifth and final method assumes that you have DLL, in which images are saved as a resource. Images are uploaded based on the resource number. As an example, we used the system shell32.dll, in which a lot of Windows icons are stored.
Initially, an invisible icon is created. You need to call the Show() method in order to display it.
To hide an icon, call the Hide() method.
A Notification Balloon
The icon for the balloon can be in two sizes: SMALL and LARGE. Upload methods are those that were used for icons. If you choose to work with a small icon (SMALL), then the image size must strictly correspond to the system set size, otherwise it will not be displayed. That's why I recommend using a large icon size for the balloon or using any of the built-in icon types (NIIF_INFO, NIIF_WARNING, NIIF_ERROR).
The size of the uploaded image must not be less than the value returned by GetSystemSize().
To display the balloon, call the Show() method.
Call Hide() to hide it.
Low values of time intervals in the Show() method are not processed by the system (the minimum delay is about 10 seconds). In order to overcome this restriction, we need to start the timer and call the Hide() method. The algorithm is implemented inside the DoTimer() function.
A Tooltip
A tooltip is shown when you hover the mouse over the icon. The tooltip text can have several lines separated by "\n".
Below I provide an example of how to use the library with an indicator. The color of the icon indicates the values of . Blue means an upward movement, red means a downward direction. Balloons are shown when direction changes.
The library works in the strategy tester. Its code is compatible with MQL4. The library can further be improved by adding functionality for the icon animation. I hope that MQL community will make its contribution to the library development.
You may also like: MT5 to Telegram Professional Library - excellent alternative for library users on MetaTrader 5.
⚠ 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.