Deposit And Withdrawal Ledger
Every trade export includes balance operations mixed in with real trades, usually distinguishable only by an empty symbol column if you notice it at all. Finding "how much did I actually deposit this year" means scrolling the Account History tab by eye, which is slow and easy to miscount. This script filters the history pool down to cash operations only and writes only those rows. Direction is read from the sign of the amount rather than assumed: a positive balance operation is a deposit, a negative one a withdrawal, and the same logic applies to credit added or removed. A zero-amount row is labelled an adjustment instead of being forced into either bucket, because guessing a direction for a number that has no sign is worse than saying so plainly. A running total column accumulates across the exported rows in the order the terminal stored them, which for balance/credit operations is already chronological - there is no open and close pair to reconcile, so no re-sorting is needed the way a trade export would need it. Notes and limitations - Only what the terminal's history has loaded can be exported. Extend the visible history range first if the ledger looks short. - On MQL4, order type 7 is commonly used for credit operations but is not an officially documented constant name; this script treats it as credit on the strength of established convention. On MQL5, DEAL_TYPE_CREDIT is a genuine documented constant - see the DIFFERENCES section above. - The running total covers only the exported cash operations. It is not an account balance and does not include trading profit or loss. - A broker that never uses credit operations will simply produce zero rows of that type - this is expected, not an error.
Script · MT4 · v1.0 · Free
About Deposit And Withdrawal Ledger
Deposit And Withdrawal Ledger is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as From date, To date and Include credit. MQL source code included.
Files in the download: DepositWithdrawalLedger.ex4, DepositWithdrawalLedger.mq4, DepositWithdrawalLedger.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| From date | 0 | From date (1970.01.01 = no lower bound) |
| To date | 0 | To date (1970.01.01 = up to now) |
| Include credit | true | Include credit operations (type 7), not only balance |
| Delimiter | DelimiterComma | CSV column separator |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Alerts · MT4 Script · MQL4 Source Code