거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Facebook에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
라이브러리

TesterReport: read a saved Strategy Tester report into deals and trades - MetaTrader 5용 라이브러리

Mohamed-amine Baddir
Mohamed-amine Baddir
MetaTrader 5용 Expert Advisor(EA)를 개발하고, 실제 거래에 사용하기 전에 충분히 테스트합니다.
제가 제공하는 작업:
고객의 전략, TradingView 스크립트 또는 문서화된 규칙을 깔끔한 MT5 Expert Advisor로 구현
기존 EA 수정 및 문제 해결: % 기준 리스크 포지션 사이징, 트레일링 스톱, 세션 및 시간 필터, 스프레드 필터, 멀티 심볼 포트폴리오, 드로다운 보호 기능
조회수:
147
평가:
(2)
게시됨:
\MQL5\Include\TesterReport\ \MQL5\Scripts\TesterReport\
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

TesterReport.mqh reads a Strategy Tester report saved as HTML (Backtest tab > right click > Report > HTML) and gives you its deals, its closed trades and the main figures, so other MQL5 code can work with a backtest after it is saved: compare reports, combine them into a portfolio, export them, or check them against the account history.

Usage

#include <TesterReport\TesterReport.mqh>

CTesterReport report;
if(report.Load("MyTest.htm"))            // a file in MQL5\Files; Load(file, true) for the common folder
  {
   for(int i = 0; i < report.Trades(); i++)
     {
      SReportTrade t;
      report.Trade(i, t);                // open, close, symbol, buy, volume, entry, exit, profit, swap, commission, net, balance
     }
   double maxMoney, maxPercent, relMoney, relPercent;
   report.BalanceDrawdowns(maxMoney, maxPercent, relMoney, relPercent);
  }
else
   Print(report.LastError());

What it reads

  • The settings of the test: Expert Advisor, period, currency and the initial deposit.
  • Every row of the Deals table (SReportDeal): time, ticket, symbol, type, direction, volume, price, commission, swap, profit, balance, comment.
  • The closed trades (SReportTrade). The report has no position numbers, so each exit is matched with the oldest open entries of the same symbol and the opposite side. A partial close or a reversal gives one trade per part, and the commission of the entry is shared in proportion to the closed volume.
  • NetProfit(), and the balance drawdowns as the report shows them: "Maximal" (the largest fall in money, with its percent) and "Relative" (the largest fall in percent, with its money). Deposits and withdrawals made after the first trade are kept out of the drawdown, as the tester does.

Reports saved by the terminal are UTF-16; UTF-8 copies are read too.

Example

The script TesterReportExample.mq5 reads a report from MQL5\Files, prints the summary and the results by symbol and side, and writes every closed trade to a CSV file (picture 1).

Output of TesterReportExample.mq5

Checked

On 12 saved reports (one to seven symbols, execution delay, withdrawals during the test, deposits from 2 000 to 100 000), the net profit and both balance drawdowns were equal to the figures in the report header, and the 9 874 closed trades were identical to an independent Python reader of the same files.

Files

TesterReport.mqh goes to MQL5\Include\TesterReport, TesterReportExample.mq5 to MQL5\Scripts\TesterReport.

Live Test Bench: automated checks of an EA on a demo account Live Test Bench: automated checks of an EA on a demo account

Automated checks of an Expert Advisor on a live demo chart (restart, second copy, server history, chart button) with a PASS/FAIL report.

AccountGuard - lock your EA to licensed accounts (single include) AccountGuard - lock your EA to licensed accounts (single include)

Single-header account lock for MT5 EAs: licensed account numbers, optional demo allowance, expiry date, tester bypass. Licence compiled in with #define. No DLL.

PortfolioWeights: risk parity, HRP, minimum variance and maximum diversification PortfolioWeights: risk parity, HRP, minimum variance and maximum diversification

Portfolio weights from the returns of symbols or Expert Advisors: inverse volatility, risk parity, hierarchical risk parity, minimum variance, maximum diversification, Ledoit-Wolf covariance.

DrawdownBootstrap: Monte Carlo of the maximal drawdown DrawdownBootstrap: Monte Carlo of the maximal drawdown

Block bootstrap of daily results: how deep the drawdown of an account or strategy can get over the next months, with percentiles and a seeded generator for repeatable runs.