Calculating and Displaying Daily Account Drawdown in MetaTrader
Summary
The document shows how to display a daily account profit or loss percentage on a MetaTrader chart. Its calculation selects account deal history, sums the current day’s realized trading profit together with commission and swap, and adds current open profit to estimate the day’s result. It then divides that amount by an estimated starting balance and displays the percentage in a chart label.
This is a practical account-monitoring example rather than a trading strategy. The code also distinguishes non-trading deal types when accumulating deposits, but the resulting deposit value is not used in the displayed calculation. The date comparison uses the platform’s current date and time, so the reported period depends on the terminal’s clock and account history availability. The document gives no validation examples and does not explain treatment of withdrawals, balance adjustments, or other edge cases; users should check that the metric matches their account’s definition of daily drawdown.
Key ideas
- The monitor estimates daily performance from realized trades and current open profit.
- Realized profit is adjusted for commissions and swaps before being combined with open profit.
- The resulting amount is expressed as a percentage of an estimated starting balance.
- The displayed value depends on the terminal’s current date and accessible deal history.
- Deposits and other balance adjustments may require additional handling to produce a preferred drawdown definition.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.