Best Interval

Best Interval
Download ALL MT5 librarys (393)
YouTube Video Thumbnail



Similar MetaTrader Tools

Best Interval

Info

The Best Interval is a Library for MetaTrader 5 that market laws depend on the intra-day or intra-week intervals. This is why it is reasonable to limit your trading system by time.

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 Best Interval

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

Market laws depend on the intra-day or intra-week intervals.

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: CIs Session - class to set time intervals (sessions) - another powerful library for MetaTrader 5 traders.


Market laws depend on the intra-day or intra-week intervals. This is why it is reasonable to limit your trading system by time.

Also recommended: Day Positions Count - similar library with strong performance on MetaTrader 5.

For example, there are scalping trading systems that are good at trading at Asian and American sessions. Disabling the trading system during high volatility periods is also practiced.
Accordingly, a problem arises:
How to find the best time for trading with your TS?
As a rule, this interval is searched for either by intuition or by shouldering the standard Tester. Let us forget about intuition as a non-technical case. As to using the standard Tester in solving such a problem, this automatically leads to significantly increasing the number of runs and, accordingly, the Optimization and the money (Cloud). However, there will still be some points that could be improved.
It is also possible that there is a really good TS. However, its positive features are hidden, since there is no time filtere in it. After all, if it were possible to find a suitable trading interval for that TS, it would not be trashed, but would trigger additional research...
Implementation.
This cross-platform library allows the system to find the optimal trading interval very quickly and as efficiently as possible.
Example of use with comments:
Now, let's have a look at the real application of the library within the scalper EA.
Scalper.
Let's launch the round-the-clock scalper in MT5 Tester. We will see the following
look at the single pass log
here is the raw passage data - no intervals are discarded.
Now let's provide consecutively the further log entries, where the effect of deleting weak intervals would be shown gradually.
One interval is deleted:
Highlighted strings are trading intervals. We can see that there is no trading from 10-11 am. The interval is deleted.
Two intervals are deleted:
Finally, three intervals are deleted
Note how the TS parameters improve with each deleted interval.
Let's apply the calculated filter to the TS
We can visually compare the two charts BEFORE and AFTER. Perhaps, someone would make an appropriate GIF animation for clarity...
As a result, the TS parameters have been improved significantly almost for free: We have spent as little efforts and time as possible.
OnTester.
The example above was based on adding just two strings into the initial EA
The highlighted string allows you not to write anything else in the EA. At the same time, the custom optimization criterion is also specified, allowing the optimizer not to look for good intervals in the old-fashioned way. The criterion immediately returns the TS result on a good interval calculated and show the TS potential much better than when using standard Optimization.
To apply the found interval upon calculating thereof, set
BestInteval Action = true
in its inputs.
Summary.
All TSes should be broadly checked, including the best trading interval calculation. Therefore, this tool is a must-have.
It is reasonable to connect to all current, past, and future TSes (using the two strings above) the search for an optimal trading interval. This implementation facilitates considerably creating a profitable TS or improving the robustness of an existing one
Features.

It is recommended to enable/disable trading on the intervals detected, using the .

The library algorithm is very fast. It can be easily implemented in third-party trading analyzers for the same purpose.

This is my own idea. Perhaps there are similar solutions.

I have not got around yet to implement intra-week intervals. Maybe later...

The library is a cross-platform one. It is relevant for both MT4 and MT5.

The best interval is calculated and then applied in the Tester without modifying the original EA source code.P.S.
Please share your experience of applying the library BEFORE and AFTER (as described above) as screenshots and appropriate MT4/5 single pass log segments.

You may also like: Optimal F for MQ L5 (per Ralph Vince) - excellent alternative for library users on MetaTrader 5.


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.