Guarda come scaricare robot di trading gratuitamente
Ci trovi su Facebook!
Unisciti alla nostra fan page
Script interessante?
Pubblica il link!
lasciare che altri lo valutino
Ti è piaciuto lo script? Provalo nel Terminale MetaTrader 5
Librerie

TesterStats: Strategy Tester report statistics in MQL5 code - libreria per MetaTrader 5

Mohamed-amine Baddir
Mohamed-amine Baddir
Sviluppo Expert Advisor per MetaTrader 5 e li testo correttamente prima che tu li utilizzi per fare trading.
Cosa faccio:
- Trasformo la tua strategia, il tuo script TradingView o le tue regole scritte in un Expert Advisor MT5 pulito
Visualizzazioni:
131
Valutazioni:
(2)
Pubblicato:
\MQL5\Include\ \MQL5\Experts\
Freelance MQL5 Hai bisogno di un robot o indicatore basato su questo codice? Ordinalo su Freelance Vai a Freelance

TesterStats.mqh calculates the statistics of the Strategy Tester report from the deal history. It also gives the ones that TesterStatistics() does not return: Z-Score, AHPR, GHPR, LR Correlation and LR Standard Error. You can use them in a custom optimization criterion, or on a live account to get the same numbers as in a backtest report.

TesterStats in OnTester() and the tester report of the same test

#include <TesterStats.mqh>

CTesterStats stats;

void OnTick()
  {
   stats.TrackEquity();      // only needed for the equity drawdown and the recovery factor
   ...
  }

double OnTester()
  {
   stats.Calculate();        // or stats.Calculate(magic, symbol)
   Print(stats.Text());
   return(stats.ghpr);
  }

I checked it against the tester in 5 tests (EURUSD, USDJPY, XAUUSD, fixed lots and percent risk, with and without TesterWithdrawal) by comparing 44 values with TesterStatistics() and the HTML report. With "1 minute OHLC" and "Every tick" all 44 were the same. With "Every tick based on real ticks" the tester checks the equity less often, so the equity drawdown here was 0.05% to 0.26% deeper; the other values were the same.

Rules of the report that the code follows: a trade with a result of 0.00 counts as a profit trade; deposits and withdrawals after the start are kept out of the balance drawdown, and for the equity drawdown a withdrawal starts a new peak; AHPR and GHPR count a withdrawal as a loss; the Z-Score probability is taken from Z rounded to 2 digits. Sharpe Ratio is not included. Tested on accounts without commission.

TesterStatsExample.mq5 is a moving average cross whose optimization criterion is GHPR weighted by the LR Correlation.

ICT Kill Zones - Asian, London, New York in New York time, with summer time ICT Kill Zones - Asian, London, New York in New York time, with summer time

ICT kill zones (Asian, London, New York, London Close) at the right New York hours on any broker, with US and EU summer time. High / low boxes, levels until price takes them, midnight open. Alerts and buffers for EAs.

Order Blocks and Breaker Blocks (SMC) - no repaint, with mitigation and alerts Order Blocks and Breaker Blocks (SMC) - no repaint, with mitigation and alerts

Marks the order block behind each break of market structure (the last opposite candle before the move), tracks when it is used and turns failed blocks into breaker blocks. No repaint. Alerts and buffers for EAs.

Session Range Breakout: Asia, London and New York high/low levels Session Range Breakout: Asia, London and New York high/low levels

Session Range Breakout draws the high and low of up to three intraday sessions (Asia, London and New York by default) and extends each level to the right with optional H/L labels and a range rectangle. Session hours, names and colours are configurable in server time. Optional popup, sound and push alerts fire when a bar closes outside a session range. The levels are fixed once the session closes, so the drawing does not repaint. The indicator draws chart objects only and never opens trades.

Non-Repainting Fair Value Gap Detector Non-Repainting Fair Value Gap Detector

Non-repainting three-bar Fair Value Gap detector for MetaTrader 5. Closed-bar detection, the 50% Consequent Encroachment level, mitigation as an explicit state machine, incremental scanning, and a built-in self-audit that re-checks the stored gap levels against the closed-bar series on attach. Pure native MQL5, no DLLs, no external dependencies.