This code is acustom 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.
Gets the history of trades from the tester
Checks minimum requirements (at least 50 trades)
Determines initial deposit and time periods
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
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)
Compares IS and OOS distributions using the Kolmogorov-Smirnov test
Checks normality of distributions using the Jarque-Bera test
Creates a comprehensive strategy evaluation that takes into account:
Profitability (30%)
Consistency of results (30%)
Risk-adjusted performance (25%)
Statistical quality (15%)
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
Use to validate the stability of the strategy
Analyse discrepancies between IS and OOS periods
Identification of over-optimised strategies
To objectively compare different strategies
To rank strategies according to a comprehensive criterion
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
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.
Translated from Russian by MetaQuotes Ltd.
Original code: https://www.mql5.com/ru/code/63121
3 way Aroon value calculation
Showing different ways of the Aroon values calculation
Pinbar Detector
This MQL5 indicator identifies Upward (Bullish) and Downward (Bearish) Pinbars, displayed with customizable arrows (lime for upward, red for downward). It allows fine-tuning of detection parameters like tail body ratio and protrusion. Pop-up and push notification alerts signal new pinbars. Ideal for traders seeking precise reversal pattern detection.
Balance Of Power
The Balance of Power (BOP) is an indicator originally developed by Igor Livshin in 2001 to measure the balance of power between buyers and sellers during each candle.
PriceVar
PriceVar% is an indicator designed to measure the percentage difference between the price and a moving average, highlighting the strength of the market movement in relation to a reference value.