DaysOfWeekCheck - MetaTrader 5 Library | MT5 EA Download - MetaTrader 5 Resources
This function is used to determine weekends on the server. This will be especially useful for those who use the OnTimer() function for event handling in Expert Advisors. Using the OnTimer() function on weekends (if the terminal is not closed during this period) may result in multiple unnecessary transaction requests being sent, wasting PC resources.
The DaysOfWeekCheck() function in the provided library has been implemented to prevent such events from occurring. To use this function, its checking algorithm must be placed at the very beginning of the OnTimer() function body in the Expert Advisor code:
blank timer () { //---- If (!DayOfWeekCheck()) returns ;
The execution part of the EA trading code must be placed after checking the algorithm at the end of the week. Therefore, OnTimer() function activity will be restricted on weekends because it will not pass the check.
This function uses the DaysOfWeekCheck.mqh library (should be copied to terminal_data_folder\MQL5\Include). Before applying the function globally, the library contents should be placed into the developed code using the #include directive:
Attachment download
📎 daysofweekcheck.mqh (1.05 KB)
Source: MQL5 #962
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •