Alım-satım robotlarını ücretsiz olarak nasıl indirebileceğinizi izleyin
Bizi Facebook üzerinde bulun!
Fan sayfamıza katılın
Kodu ilginç mi buldunuz?
Öyleyse bir link gönderin -
başkalarının da faydalanmasını sağlayın
Kodu beğendiniz mi? MetaTrader 5 terminalinde deneyin
Kütüphaneler

TesterStats: Strategy Tester report statistics in MQL5 code - MetaTrader 5 için kütüphane

Mohamed-amine Baddir
Mohamed-amine Baddir
MetaTrader 5 için Expert Advisor'lar geliştiriyorum ve gerçek işlemlerde kullanmadan önce bunları düzgün şekilde test ediyorum.
Yaptığım işler:
- Stratejinizi, TradingView scriptinizi veya yazılı işlem kurallarınızı temiz ve profesyonel bir MT5 Expert Advisor'a dönüştürmek
Görüntülemeler:
100
Derecelendirme:
(1)
Yayınlandı:
\MQL5\Include\ \MQL5\Experts\
MQL5 Freelance Bu koda dayalı bir robota veya göstergeye mi ihtiyacınız var? Freelance üzerinden sipariş edin Freelance'e git

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.

MACD Signals MACD Signals

Indicator edition for new platform.