High-Performance Time Functions (Time Utils)

High-Performance Time Functions (Time Utils)
DOWNLOAD all MT5 librarys (393)
YouTube Video Thumbnail

Similar MetaTrader Tools

High-Performance Time Functions (Time Utils)

Info

The High-Performance Time Functions (Time Utils) is a Library for MetaTrader 5 that this library contains more than 80 different functions to deal with time variables. The primary aim is to provide high-performance time functions.

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 High-Performance Time Functions (Time Utils)

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 contains more than 80 different functions to deal with time variables.

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: Session Time Filter Library - another powerful library for MetaTrader 5 traders.


This library contains more than 80 different functions to deal with time variables. The primary aim is to provide high-performance time functions. The performance mode (which can be controlled at compile time via a #define) is disabled by default. This mode is not a requirement to include the library into your projects, as it can be included normally without it.

Also recommended: Time Series - Function Library for Working with Time Series - similar library with strong performance on MetaTrader 5.

TIMEUTILS_PERFORMANCE_MODE
Optionally, performance-mode can be switched on at compile time via #defines before #include:
This will redirect all calls to MQL's built-in and functions to more efficient alternatives.
You can compile the script "performance_mode.mq5" with and without TIMEUTILS_PERFORMANCE_MODEto check for the difference in speed on your machine. This will be beneficial to high-performance programs performing heavy or many time-related tasks (e.g., scanning all the quotes history for H1 bars at the start of trading weeks or collecting other statistics).
Listing of all functions in the library:
The function names should be self-explanatory; also, you can find a short description for a specific function in the TimeUtils.mqh file.
List of all available time formats:
The two attached scripts "basic.mq5" and "advanced.mq5" shows the basic and advanced usage examples.
An example output from "advanced.mq5" script:
Updates:
2024.12.03 - v.1.10 : Initial release.
2024.12.05 - v.1.15 : Added functions for business days and for Nth() weekday of the month. Optimized calculations in DaysInMonth() function.
2024.12.09 - v.1.20 : Added TimeFormat() function to format the time according to the passed string of tokens.
2024.12.09 - v.1.25 : Optimized calculations in TimeToStructFast() function.
2024.12.10 - v.1.30 : Optimized TimeFormat(), StartOfYear() and EndOfYear() functions. Updated descriptions of some functions.
2024.12.15 - v.1.35 : Optimized GetNthWeekdayInYearMonth() function.
2024.12.18 - v.1.40 : Added IsCurrentXXX(), IsToday(), IsTomorrow() and IsYesterday() functions.
2024.12.19 - v.1.45 : Optimized AddMonths() and GetNthWeekdayInYearMonth() functions.
2024.12.20 - v.1.50 : More code clean-up.
2024.12.21 - v.1.55 : Simplified calculations in AddMonths(): replaced the complex logic of adjusting months and years with a simpler total months calculation.

You may also like: YZ Summer Time - 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.
RobotFX does not own any of the code provided on this platform. All tools are freely available on the internet; we simply index and re-offer them for download. We are not responsible for any financial losses that may occur. Trading responsibilities rely solely on the traders downloading and using the displayed Expert Advisors, indicators, and scripts. These tools are provided for educational purposes only and may require modification or optimization to align with a trader's specific strategy or needs.
© ROBOTFX - Best MetaTrader Expert Advisors & Indicators