Profit By Deal-Entry-In Per Hour Report for MT5 (unlike deal-entry-out in the native Tester Report)

Profit By Deal-Entry-In Per Hour Report for MT5 (unlike deal-entry-out in the native Tester Report)

12 August 2026, 16:38
Ryan L Johnson
4
153

As the MT5 Tester does not natively support reporting hourly profit and loss by deal-entry-in (only deal-entry-out), I created this MQL5 Service to to generate custom backtest reports limited to, and based on, deal-entry-in times.

For the sake of consistency of file types, the generated reports are in .xlsx (Windows Excel) format. Unlike in the native Tester Report, the long and short trades executed within each hour are netted out in the bar graph resulting in one bar instead of two for each hour.

An MQL5 Service runs independently of any chart. Save ProfitByHourReportService.mq5 to your MQL5==>Services folder, and save ProfitByHourReplayTest to your MQL%==>Scripts folder, and compile them. Upon running the Service, starting a new backtest, and that backtest being automatically detected, a ProfitByHour folder will be created in your MQL5==>Files folder. That is where the generated report(s) are saved.

Allow DLL imports must be enabled in the Service.

Allow Algo Trading must be enabled in the Service.

Process tests finished before start must be set to true if you want to analyze preexisting backtests. Set it to false to analyze only future backtests.

See the in-code comments regarding commission and swap data.

If you don't have Excel, free OpenOffice handles .xlsx files quite nicely.

I created this Service because, frankly, setting a trade entry time filter based on a trade exit time report makes about as much sense as a football bat.

Version 1.24 was posted here at 2:30pm on 09/02/2026 NY time. This upgraded version records chunks of backtest data in testing real time to support large amounts of data. I've successfully tested it on 1.5 gigabytes of log data, and an overnight backtest, separately.

Note that when you see "Alive: journal lines [XXXXXX] - waiting for a backtest...", that is simply the Service waiting for a new chunck of data.

On a related note, you should always backtest on "Every tick based on real ticks" within your live broker-dealers' account. Prior to backtesting, I highly recommend that you check the quality of that tick data using Ayaz's TickAudit Script.