Skip to content
All library documents

Plotting a Trade History Balance Curve from CSV in MQL5

Article MQL5 articles

Summary

This tutorial shows how to turn closed-trade profit and loss values in a CSV file into a cumulative balance curve displayed in a MetaTrader 5 indicator window. It explains that the curve represents realized account changes, distinguishes balance from equity, and describes how individual trade outcomes affect the running total. The example reads the profit column, computes cumulative values and their range, then draws the curve and axes, with optional labels for each trade.

The indicator is designed to update on a timer and redraw only when the source file gains trades. The article also covers placing the CSV in a terminal-accessible folder and relies on a fixed column order, so the parser can fail or misread data if the file layout changes. The curve can help inspect gains, losses, and drawdown periods, but the displayed closed-trade history excludes floating profit and loss and does not itself provide a full risk or strategy evaluation.

Key ideas

  • A balance curve is formed by cumulatively adding realized profits and losses from closed trades.
  • The example MQL5 indicator reads trade results from a CSV and plots the progression in a separate chart window.
  • Optional labels show each trade's contribution to the running balance.
  • Timer-based updates can refresh the display when new records appear.
  • The method depends on the expected CSV structure and excludes open-position equity changes.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.