Discussing the article: "Introduction to MQL5 (Part 42): Beginner Guide to File Handling in MQL5 (IV)"

 

Check out the new article: Introduction to MQL5 (Part 42): Beginner Guide to File Handling in MQL5 (IV).

This article shows how to build an MQL5 indicator that reads a CSV trading history, extracts Profit($) values and total trades, and computes a cumulative balance progression. We plot the curve in a separate indicator window, auto-scale the Y-axis, and draw horizontal and vertical axes for alignment. The indicator updates on a timer and redraws only when new trades appear. Optional labels display per-trade profit and loss to help assess performance and drawdowns directly on the chart.

The Strategy Tester in MT5 does provide balance curves and performance statistics, but those results are strictly based on the Expert Advisor being tested. They do not reflect the actual live trades executed in a real trading account, especially when manual trades are involved. In the previous article, we explained how to export your complete trading history from MetaTrader 5 into a CSV file and how to read that file inside MQL5. We extracted key fields such as the Profit($) column and the total number of closed trades, stored them in dynamic arrays, and prepared the data for structured processing. With that foundation in place, we can now transform raw historical data into a practical analytical tool inside the terminal.

By the end of this article, you will have a fully functional MQL5 indicator for MT5 that reads a CSV file containing your trade history, specifically the example file created in the previous article, which will also be attached to this guide. You will learn where to place the CSV file so that it is accessible to MT5. The indicator will extract the Profit($) values from this CSV and calculate a cumulative balance curve. The curve will then be plotted in another window, with the vertical axis automatically scaled according to the progression's minimum and maximum values.

Both horizontal and vertical axes will be drawn to align the curve with the data, and an input setting allows you to enable or disable numeric profit/loss labels for each trade directly on the chart. Using the OnInit and OnTimer event handlers, you will set up the indicator to update dynamically while ensuring the curve only redraws when new trades appear in the CSV. This provides a clear, verifiable visual representation of account performance, turning static CSV data into an actionable trading tool.

Author: Israel Pelumi Abioye