Loading…

What Closes At This Price

"What happens to my account if EURUSD gaps to 1.0500 over the weekend" is a question every discretionary trader asks and few tools answer directly. This script answers it literally: type the hypothetical price, and it walks every open position, checks whether that price crosses the position's own stop or target, and totals up the resulting equity. Symbols not mentioned in the input keep their current market price for the calculation, so a single "what if EURUSD gaps" question can be asked without having to also type a hypothetical for every other symbol in the book. A hypothetical is a single number with no spread, which means a position whose stop and target have both been crossed by that one number cannot be resolved from the number alone - a real market would have touched one of them first, and a single snapshot cannot say which. The script reports the stop loss as the winner in that case, the conservative worst-case reading, and says explicitly on that line that the target was also crossed so the ambiguity is never hidden inside a single confident-looking outcome. Pending orders are checked too, for whether the hypothetical price would trigger their entry, and reported separately - they are not folded into the equity total, since a triggered pending order's own eventual outcome is a second, separate question this script does not chase recursively. Notes and limitations - Uses a single hypothetical price per symbol with no spread. Real execution would happen at the bid or ask, a small amount away from the number typed. - When both a position's stop and its target are crossed by the same hypothetical price, the stop is assumed to have won - the conservative reading, and flagged explicitly on that line, but it is an assumption, not a certainty. - Triggered pending orders are reported but not simulated further; their own resulting position is not added to the equity total. - Ignores slippage, requotes and any broker-side rejection that a real gap move could cause - it answers "what does the math say," not "what would actually fill." - Balance and credit are read as of the moment the script runs; any trade opened or closed between reading them and reading the position list is not accounted for.

Script · MT5 · v1.0 · Free

About What Closes At This Price

What Closes At This Price is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 2 settings, such as Price list and Include pendings. MQL source code included.

Files in the download: WhatClosesAtThisPrice.ex5, WhatClosesAtThisPrice.mq5, WhatClosesAtThisPrice.txt.

Settings

SettingDefaultWhat it does
Price listEURUSD=1.0500Comma-separated Symbol=Price pairs, e.g. EURUSD=1.05,USDJPY=150
Include pendingstrueAlso report pending orders whose entry would trigger

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 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: EURUSD · Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria