Comments - MetaTrader 5 Library - MQL5 #53499 | MT5 EA Download - MetaTrader 5 Resources






Simple replacement for comments. The tester works 50 times faster than standard functionality.
The standard "annotation" feature is known to slow down testers tremendously.
Here is an example of the code and its execution time in the tester.
Blank check () { MQTick tick; SymbolInformationTick ( _symbol , tick); if (check.ask!= 0 && check.bid!= 0 ) { string str = string format ( "ask=%.5f\nbid=%.5f\ntime=%s" , tick.ask, tick.bid, string time (tick_time, TIME_DATE | TIME_SECONDS )); comment (str); } } //+------------------------------------------------------------------+

11 minutes and 28 seconds! ! !

Just add the code #include
#include <communication.mqh> //+----------------------------------------------------------------------------------+ Blank check () { MQTick tick; SymbolInformationTick ( _symbol , tick); if (check.ask!= 0 && check.bid!= 0 ) { string str = string format ( "ask=%.5f\nbid=%.5f\ntime=%s" , tick.ask, tick.bid, string time (tick_time, TIME_DATE | TIME_SECONDS )); comment (str); } } //+------------------------------------------------------------------+

14 seconds! ! !
Usage example of default settings.
There is no need to declare an instance of this class.
#include <communication.mqh> //+----------------------------------------------------------------------------------+ Blank check () { string str = "program name=" + MQL information string ( MQL_PROGRAM_NAME ) + "\n" + ( string ) time current (); comment(str); } //+------------------------------------------------------------------+

Usage example of being able to change settings.
#include <communication.mqh> //+----------------------------------------------------------------------------------+ Blank check () { string str = "program name=" + MQL information string ( MQL_PROGRAM_NAME ) + "\n" + ( string ) time current (); annotation (str, _Xpx, _Ypx, _clrText, _FontSize, _clrBack, _Transparency, _Font, _corner); } //+------------------------------------------------------------------+

Example of using multiple instances of annotations.
#include <communication.mqh> CComm communication 1; CComm communication 2; CComm communication 3; CComm Communication 4; //+------------------------------------------------------------------+ Blank check () { MQTick tick; SymbolInformationTick ( _symbol , tick); if (check.ask!= 0 && check.bid!= 0 ) { string str = string format ( "ask=%.5f\nbid=%.5f\ntime=%s" , tick.ask, tick.bid, string time (tick_time, TIME_DATE | TIME_SECONDS )); comment(str); comm1.Comm(str, _Xpx, _Ypx + 80 , _clrText, _FontSize, _clrBack, _Transparency, _Font, _corner); comm2.Comm(str, _Xpx + 10 , _Ypx + 20 , _clrText, _font size, clear green , _transparency, _font, corner lower left corner ); comm3.Comm(str, _Xpx + 30 , _Ypx, clear green , _font size, _clrBack, _transparency, _font, CORNER_RIGHT_LOWER ); comm4.Comm(str, _Xpx, _Ypx + 50 , black , _font size, _clrBack, _transparency, _font, CORNER_RIGHT_UPPER ); } } //+------------------------------------------------------------------+

Updated December 5, 2024 version 1.06
Updated December 5, 2024 version 1.07
Attachment download
📎 example.mq5 (0.94 KB)
📎 comm.mqh (19.43 KB)
Source: MQL5 #53499
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •