time frames dll for mt4/mt5

time frames dll for mt4/mt5
Download ALL MT4 scripts (422)
YouTube Video Thumbnail



Similar MetaTrader Tools

time frames dll for mt4/mt5

Info

The time frames dll for mt4/mt5 is a Script for MetaTrader 4 that this library provides a comprehensive set of functions for managing and converting time frame information in metatrader 4 and metatrader 5 platforms. time frames can be represented in several ways:- short name (e.

Usage

This tool is typically used for enhancing chart analysis and decision making.

Platform

This Script works exclusively on MetaTrader 4 (both build 600+ and newer versions).

Setup

Place the downloaded file in MQL4/Scripts folder via File ? Open Data Folder in MetaTrader 4.


How to Install and Use time frames dll for mt4/mt5

1. Installation: Move your script file into the MQL/Scripts directory and restart the platform.

2. Execution: Drag the script onto a chart; it will perform a one-time action, such as closing all open orders or clearing chart objects.

3. Editing: Use MetaEditor (F4) to modify code, click "Compile," and verify no errors appear in the terminal before running.

4. Removing: Scripts stop automatically, but you can remove them manually by right-clicking the chart and choosing "Remove Script."

Frequently Asked Questions

Q: How are scripts different from EAs? A: Scripts execute a single action and then stop; EAs monitor the market and trade continuously.

Q: Can I assign a hotkey to a script? A: Yes, right-click the script in the Navigator, select "Set Hotkey," and define your preferred keyboard shortcut.

Q: Why did my script stop? A: Scripts are designed to stop immediately after finishing their programmed command; this is normal behavior.

What this tool does

this library provides a comprehensive set of functions for managing and converting time frame information in metatrader 4 and metatrader 5 platforms.

Typical Use Case

This Script excels in automated trading and technical analysis on MetaTrader 4.

Compatible Platform & Setup

This Script works on MetaTrader 4. Place the file in the MQL4/Scripts folder and restart the terminal.

Description & Settings

Related: triple timeframe cci indicator - another powerful script for MetaTrader 4 traders.

this library provides a comprehensive set of functions for managing and converting time frame information in metatrader 4 and metatrader 5 platforms.

Also recommended: i-spread3: real-time spread indicator - similar script with strong performance on MetaTrader 4.


time frames can be represented in several ways:

- short name (e.g., m1, d1, mn1): used for time frame switching buttons.
- full name (e.g., "m1", "daily", "monthly"): used in chart titles.
- period in minutes (e.g., 1, 1440, 43200): used as predefined constants.
- time frame order number (e.g., 0, 6, 9): used for iterating through time frames.

the library's functions facilitate conversion between these different representations of time frame attributes.

the library supports distinct sets of time frames:

- mt4 time frames (9 periods): m1, m5, m15, m30, h1, h4, d1, w1, mn1.
- mt5 time frames (21 periods): m1, m2, m3, m4, m5, m6, m10, m12, m15, m20, m30, h1, h2, h3, h4, h6, h8, h12, d1, w1, mn1.
- all possible time frames (24 periods), including those in multiples of hours and days, up to a 4-year period: m1, m2, m3, m4, m5, m6, m10, m12, m15, m20, m30, h1, h2, h3, h4, h6, h8, h12, d1, w1, mn1, q1, yr1, yr4.

the library includes 22 functions to manage time frame data:

time frame name validation functions:
- tfcheckname9(string snameperiod): validates mt4 time frame names. returns true if valid, false otherwise.
- tfcheckname21(string snameperiod): validates mt5 time frame names. returns true if valid, false otherwise.
- tfcheckname24(string snameperiod): validates all supported time frame names. returns true if valid, false otherwise.
- tfchecknamereturn9(string snameperiod): validates mt4 time frame names and returns the canonical name if valid, or an empty string if invalid.
- tfchecknamereturn21(string snameperiod): validates mt5 time frame names and returns the canonical name if valid, or an empty string if invalid.
- tfchecknamereturn24(string snameperiod): validates all supported time frame names and returns the canonical name if valid, or an empty string if invalid.

time frame period check functions:
- tfcheckperiod9(int nperiod): checks if a given period in minutes is a valid mt4 time frame. returns true if valid, false otherwise.
- tfcheckperiod24(int nperiod): checks if a given period in minutes is a valid time frame across all supported types. returns true if valid, false otherwise.

time frame name retrieval functions:
- tfnamebyperiod9(int nperiod): returns the short name of an mt4 time frame given its period in minutes.
- tfnamebyperiod24(int nperiod): returns the short name of a time frame given its period in minutes for all supported time frames.
- tfnamechart9(int nnumberperiod): returns the chart title name of an mt4 time frame given its order number.
- tfnamechart24(int nnumberperiod): returns the chart title name of a time frame given its order number for all supported time frames.
- tfnamechartbyperiod9(int nperiod): returns the chart title name of an mt4 time frame given its period in minutes.
- tfnamechartbyperiod24(int nperiod): returns the chart title name of a time frame given its period in minutes for all supported time frames.
- tfnameperiod9(int nnumberperiod): returns the short name of an mt4 time frame given its order number.
- tfnameperiod24(int nnumberperiod): returns the short name of a time frame given its order number for all supported time frames.

time frame order number retrieval functions:
- tfnumberbyperiod9(int nperiod): returns the order number of an mt4 time frame given its period in minutes. returns -1 on error.
- tfnumberbyperiod24(int nperiod): returns the order number of a time frame given its period in minutes for all supported time frames. returns -1 on error.

time frame period retrieval functions:
- tfperiod9(int nnumberperiod): returns the period in minutes of an mt4 time frame given its order number. returns -1 on error.
- tfperiod24(int nnumberperiod): returns the period in minutes of a time frame given its order number for all supported time frames. returns -1 on error.
- tfperiodbyname9(string snameperiod): returns the period in minutes of an mt4 time frame given its short name. returns -1 on error.
- tfperiodbyname24(string snameperiod): returns the period in minutes of a time frame given its short name for all supported time frames. returns -1 on error.

included files:

1. timeframes.dll: the main library file.
2. timeframes.mqh: the header file for the library.
3. check_timeframes.dll.mq4: a test script demonstrating example usage.
4. timeframes.zip: an archive containing all the above files, organized for mt4 installation.

usage guidance:

examples of function usage can be found in the test script check_timeframes.dll.mq4.
a full description of functions and their parameters is available in the library header file timeframes.mqh.
please ask questions if the examples are unclear or if you have suggestions for library improvements.

You may also like: Big Bars Indicator for Higher Timeframes - excellent alternative for script users on MetaTrader 4.

Source Code

#property copyright "robotfx"
#property link "https://robotfx.org"
#property show_inputs
#include <timeframes.mqh> //    "timeframes.dll"       mt4  mt5.
#define period_m1                         1 // 1 .
#define period_m2                         2 // 2 .
#define period_m3                         3 // 3 .
#define period_m4                         4 // 3 .
#define period_m5                         5 // 5 .
#define period_m6                         6 // 6 .

.......

Leave your opinion, ask a question, share some knowledge

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 Free educational tools by RobotFX. Use entirely at your own risk; we are not liable for any financial losses incurred.