CDatetimeMsc - MetaTrader 5 Library | MT5 EA Download - MetaTrader 5 Resources


When I recently started intensively testing the functionality of CopyTicksRange(), I encountered some unfavorable issues when dealing with millisecond times:
Here I'm running into difficulties, for example the milliseconds is a very vague number and doesn't tell you the exact date. However, if you use CDateTime or TimeStruct, all time units are easily changed, but the format separates them and the results are unclear. The CDateTimeMsc class was created to solve this problem.
#includes <tools\DateTime.mqh> struct CDateTimeMSC: public datetime { public : Integer MS; // Additional variable datetime for MSC storage Check datetime; // A little overhead is required for easy observation. //--- CDateTimeMsc method Oolong MSC time ( blank ) { return ( Oolong ( double (CDateTime::DateTime()) * 1000 ) + MSC);} blank msc_time( oolonga_msc_time ); // input (datetime*1000) blank msc( integer value); //bool IsNumInt(const int num); blank MSCDec( integer delta = 1 ); blank msc( integer delta = 1 ); Blank seconds time ( integer a_int_time); Oolong seconds time ( blank ); Blank update datetime(); // Update observation variable check_datetime blank datetime( datetimea_datetime ) {CDateTime::DateTime(a_datetime);updatedatetime();} Date Time Date Time ( blank ) { return (CDateTime::DateTime());} };
New methods are inserted under the inheritance of the old structure.
Now, the class is actually a struct (see struct/class), milliseconds can also be used, provided there is such a precise time.
Additionally, the increment and decrement methods have been extended to the msc attribute.
Now one might argue whether the additional variable "check_datetime" is really necessary as it incurs some overhead (which for some people is very important). However, I assume that you won't typically use many CDateTime objects, just a few in important places where you need to change the time unit (such as hours, minutes, seconds, or days). I also have some issues with the UpDateTime() method, which is being called unnecessarily on every increment/decrement.
All in all, however, processing factors are the main focus.
Test <br/>If you want to know the exact date, you no longer need to query the time with an additional datetime variable, but just put the variable "check_datetime" under supervision: (TestEA see above)
Millisecond times are automatically converted to datetime format.
Set up three crossovers and monitor daily percentage performance starting from a given time (which can also be set).
An idea by Andrey F. Zelinsky, based on William Blau's indicator
Professional visual indicator for the popular "One Candle" daily breakout strategy (0.9 SL / 1.25 TP). Automated vector analysis of Gold (XAUUSD).
The indicator implements a non-linear smoothing algorithm
Attachment download
📎 datetimemsc.mqh (5.31 KB)
📎 testeadatetimemsc.mq5 (3.19 KB)
Source: MQL5 #48156
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •