Loading…

Daily Loss Limit Snapshot

Many traders running prop accounts or discretionary strategies enforce a daily stop loss — if losses reach a threshold, close out and take the rest of the day off. The rule is simple to state and difficult to follow in real time. When the market is moving and positions are open, it is easy to lose track of how much the account is down today. Most traders who track it do so mentally, which is error prone, or check the terminal balance once per hour, which misses the moves between checks. This script takes the snapshot now. It sums every closed deal from today and adds the floating loss on every open position, then compares the total against the daily limit you set. It reports both the absolute remaining budget and the percentage of the daily limit that has been consumed. Notes and limitations - All times are in account server time (terminal GMT/UTC setting). - "Today" runs from 00:00 to 23:59 in server time, which may not match your local definition if your broker operates in a different timezone. - The snapshot is taken at the moment the script runs; positions closed or opened in the next second are not included. - Commission and swap are included in the profit/loss calculation per order (MQL4) or per deal (MQL5). - On a netting account, a position reversal closes one side and opens another. Both sides are included in today's count. - Pending orders carry no P&L and are ignored. - MQL5's closed-loss total only recognises exit deals (DEAL_ENTRY_OUT / DEAL_ENTRY_OUT_BY) as "today's closed loss". A position whose entry commission was charged on a different calendar day than its exit is still counted correctly for realised P&L, but that entry-day commission is attributed to the day it was actually charged, not the day the position closed - a difference from MQL4's single bundled per-order figure that is only visible on same-day-open-and-close trades split across a server-day boundary, which is rare in practice.

Script · MT4 · v1.0 · Free

About Daily Loss Limit Snapshot

Daily Loss Limit Snapshot is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 2 settings, such as Daily loss limit account and Include floating. MQL source code included.

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

Settings

SettingDefaultWhat it does
Daily loss limit account500.0Daily loss limit, in account currency
Include floatingtrueInclude unrealised losses in total

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 · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria