This article presents a read-only trade journal for MetaTrader 5 that groups account deals into positions and calculates closed-trade statistics, including profit factor, expectancy, drawdown, and win and loss streaks. It breaks the results down by entry hour and weekday, shows them in a chart panel, and exports the closed positions to a CSV file. The implementation covers HistorySelect, deal and position identifiers, closed-trade sorting, and object-based panel rendering.
The History tab in MetaTrader 5 lists every deal on the account, but it does not answer the questions a trader asks after a month of trading. Which hours produce the losses? How far does the account fall from its best point before it recovers? Is the average trade worth taking? Answering these questions by hand means exporting the history and building a spreadsheet, which most traders do not do regularly. A small tool that reads the history and shows these numbers on the chart removes that step.
In practice, a journal built from account history comes with three specific challenges:
This article works through all three. It groups deals by position identifier and adds the monetary fields of each buy and sell deal to one net value per position. It sorts the closed positions by closing time before calculating drawdown and streaks. It refreshes the panel on a timer and after each new deal. It never calls trading functions, so the tool cannot place or close an order.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Check out the new article: Practical MQL5 Utilities (Part 1): Trade Journal Analytics Panel.
The History tab in MetaTrader 5 lists every deal on the account, but it does not answer the questions a trader asks after a month of trading. Which hours produce the losses? How far does the account fall from its best point before it recovers? Is the average trade worth taking? Answering these questions by hand means exporting the history and building a spreadsheet, which most traders do not do regularly. A small tool that reads the history and shows these numbers on the chart removes that step.
In practice, a journal built from account history comes with three specific challenges:
This article works through all three. It groups deals by position identifier and adds the monetary fields of each buy and sell deal to one net value per position. It sorts the closed positions by closing time before calculating drawdown and streaks. It refreshes the panel on a timer and after each new deal. It never calls trading functions, so the tool cannot place or close an order.
Author: Syed Jawad Hussain Naqvi