A script for a tester that extends the standard Meta Trader 5 optimisation features

A script for a tester that extends the standard Meta Trader 5 optimisation features
DOWNLOAD all MT5 scripts (325)
YouTube Video Thumbnail

Similar MetaTrader Tools

A script for a tester that extends the standard Meta Trader 5 optimisation features

Info

The A script for a tester that extends the standard Meta Trader 5 optimisation features is a Script for MetaTrader 5 that explanation of the code and its application what is this code. This code is acustom optimisation functionfor the MetaTrader 5 Strategy Tester.

Usage

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

Platform

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

Setup

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


How to Install and Use A script for a tester that extends the standard Meta Trader 5 optimisation features

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

Explanation of the code and its application What is this code.

Typical Use Case

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

Compatible Platform & Setup

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

Description & Settings

Related: Demo Create OB J BIT M A P Script - another powerful script for MetaTrader 5 traders.

Explanation of the code and its application What is this code?
This code is a

Also recommended: Objects Description Activator - similar script with strong performance on MetaTrader 5.

custom optimisation function
for the MetaTrader 5 Strategy Tester. It is not an Expert Advisor, indicator or script in the classical sense, but a special script for analysing test results.
How the code works: 1. Data collection

Gets the history of trades from the tester

Checks minimum requirements (at least 50 trades)

Determines initial deposit and time periods

2. Splits the data

Splits trades into two periods:

In-Sample (IS) - the first 70% of the testing period

Out-of-Sample (OOS) - the last 30% of the period with a 1-day interval

3. Calculation of metrics
Calculates a set of metrics for both periods:

Profitability and drawdown

Sharpe and Sortino ratios

Profit factor and probability of profitable transactions

Statistical indicators (skewness, kurtosis)

Special metrics (Serenity Ratio)

4. Statistical analysis

Compares IS and OOS distributions using the Kolmogorov-Smirnov test

Checks normality of distributions using the Jarque-Bera test

5. Strategy evaluation
Creates a comprehensive strategy evaluation that takes into account:

Profitability (30%)

Consistency of results (30%)

Risk-adjusted performance (25%)

Statistical quality (15%)

Where to use this code: 1. strategy optimisation

Place the code in the MQL5/Scripts/ folder.

In the strategy tester, select "Custom optimisation criterion"

Use this script to evaluate the results of optimisation

2. Strategy validation

Use to validate the stability of the strategy

Analyse discrepancies between IS and OOS periods

Identification of over-optimised strategies

3. Comparison of strategies

To objectively compare different strategies

To rank strategies according to a comprehensive criterion

Advantages of the approach:

Minimising over-optimisation through data partitioning

Comprehensive evaluation takes into account mĂșltiples aspects of performance

Statistical verification of the robustness of the results

Automatic screening of non-viable strategies

Important Notes:

Requires a significant number of trades (at least 50)

Need sufficient historical period to split into IS/OOS

Code returns -DBL_MAX for strategies that do not pass minimum requirements

This approach is particularly useful for traders and developers who want to take testing and optimising trading strategies seriously, minimising the risk of fitting to historical data.

You may also like: Schnick - Support Vector Machine Learning Tool Tester - excellent alternative for script 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