Swap Rate Snapshot Logger
Anyone who wants to study swap cost over time runs into the same wall: MetaTrader only ever shows the rate right now. There is no built-in way to see what a symbol's swap was doing a month ago, or whether it has been drifting. This tool solves that by attaching once and quietly appending a row per symbol to a CSV every time the broker day changes - over weeks it becomes exactly the dataset a carry or rollover study needs, without the user remembering to run anything. The last logged day is recovered from the CSV itself at start-up by scanning its own date column, not from a separate state file. That means restarting the terminal partway through a day never writes a duplicate row for that day, and the log can be moved, backed up or opened in a spreadsheet without breaking the logger's own bookkeeping. Every row carries the swap unit alongside the two figures. Brokers publish swap in points, in account currency or as an annual interest rate, and those numbers are not comparable across symbols that use different units - a log that dropped the unit column would quietly invite exactly that mistake months later when someone re-opens the file. Notes and limitations - A symbol whose specification is not yet loaded by the terminal is skipped for that day rather than logged as a fake zero swap; it reappears in the log once its specification loads. - The triple-swap day column comes from SYMBOL_SWAP_ROLLOVER3DAYS where the broker publishes it; brokers that do not publish it show "n/a" rather than a guessed day. - Only one row is written per symbol per broker day. A broker that changes its swap rate intraday will have that change captured on whichever check first ran after the change, not at the instant it happened. - Read-only. It never sends, modifies or closes an order - only symbol information reads and file writes are used.
Expert advisor · MT5 · v1.0 · Free
About Swap Rate Snapshot Logger
Swap Rate Snapshot Logger is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 3 settings, such as Symbol list, Log file and Check interval secs. MQL source code included.
Files in the download: SwapRateSnapshotLogger.ex5, SwapRateSnapshotLogger.mq5, SwapRateSnapshotLogger.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Symbol list | Comma separated symbols to log; empty = every Market Watch symbol | |
| Log file | SwapRateSnapshotLogger.csv | File in MQL5\Files that the daily rows are appended to |
| Check interval secs | 3600 | How often to check whether the broker day has rolled over |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 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 · MT5 Expert Advisor · MQL5 Source Code