Loading…

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 · MT4 · v1.0 · Free

About Swap Cost Monitor

Swap Cost Monitor 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 Swap alert money, Swap eating ratio and Check interval secs. MQL source code included.

Files in the download: SwapCostMonitor.ex4, SwapCostMonitor.mq4, SwapCostMonitor.txt.

Settings

SettingDefaultWhat it does
Swap alert money20.0Alert when one position's absolute swap reaches this much account currency
Swap eating ratio0.5Alert when |swap| exceeds this fraction of the position's price profit
Check interval secs30How often to rescan open positions, in seconds
Alert cooldown mins60Minimum minutes between repeat alerts for the same ticket

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Alerts · Trailing Stop & Break-even · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria