Swap Cost Monitor
Swap is easy to ignore because it never shows up as a single dramatic loss - it erodes a position a few cents or points at a time, night after night, until a trade that looks profitable on price alone is barely break-even once carry is counted. This tool scans every open position on a timer, sums swap per ticket and per symbol, and raises an alert either when one position's absolute swap passes a configured money threshold, or when swap has eaten past a configured share of that position's own price profit. Swap is compared only against price profit, never against commission. Commission is a one-off cost paid at entry; swap keeps compounding for as long as the position stays open. Blending the two into one ratio would flatten out exactly the growing-cost trend this tool exists to surface, so the two are kept separate on purpose. Alerts are rate-limited per ticket so a position that stays in breach does not spam a popup every scan; a repeat alert for the same ticket waits for the configured cooldown before firing again. Notes and limitations - The profit-share check only fires while price profit is positive; a position that is already losing on price is not additionally flagged for swap eating a profit that does not exist. - Up to 200 distinct tickets have their alert cooldown tracked at once; beyond that the oldest tracked slots are recycled, which could allow an early repeat alert on an account holding an unusually large number of simultaneous positions. - Read-only. It never sends, modifies or closes an order - only Alert and Comment are used to surface what it finds.
Expert advisor · MT5 · v1.0 · Free
About Swap Cost Monitor
Swap Cost Monitor is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as Swap alert money, Swap eating ratio and Check interval secs. MQL source code included.
Files in the download: SwapCostMonitor.ex5, SwapCostMonitor.mq5, SwapCostMonitor.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Swap alert money | 20.0 | Alert when one position's absolute swap reaches this much account currency |
| Swap eating ratio | 0.5 | Alert when |swap| exceeds this fraction of the position's price profit |
| Check interval secs | 30 | How often to rescan open positions, in seconds |
| Alert cooldown mins | 60 | Minimum minutes between repeat alerts for the same ticket |
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 · Trailing Stop & Break-even · MT5 Expert Advisor · MQL5 Source Code