Loading…

Trade Concurrency Profile

A trader who only glances at the terminal's open-orders tab never sees the account's real concurrency history - the worst pile-up of simultaneous positions may have happened, and unwound, entirely between two visits to the terminal. This script rebuilds that history instead of relying on a live snapshot. It loads every closed order's open and close time, plus every currently open order, and replays them as a chronological sequence of +1/-1 events. Walking that sequence in time order finds the exact moment the account held the most positions at once, and separately, the exact moment it held the most stop-loss-priced risk at once - the two peaks do not always coincide, since a moment with fewer positions can carry more risk if those positions were larger or had wider stops. Risk per position is priced from the stop-loss recorded on the order AT OPEN TIME, converted to money using the symbol's own tick value and tick size. MT4 keeps no audit trail of stop-loss modifications, so a stop that was trailed or moved to breakeven after entry is invisible to this replay - the risk figure reflects the stop that was in place when the position opened, not necessarily the stop that was in place when things got busiest. Notes and limitations - Risk is priced from the stop-loss recorded at open time only; a position with no stop-loss at open contributes to the peak position COUNT but 0 to the peak priced RISK figure, and is called out separately in the log rather than silently folded in as zero risk. - On an exact-second open/close tie, the close is processed before the open - the conservative choice, so a same-second pair never inflates the reported peak. - This is historical replay, not a live monitor - it reports what happened, not what is happening right now. - Pending orders that never filled are excluded, since they never held any real concurrent risk.

Script · MT4 · v1.0 · Free

About Trade Concurrency Profile

Trade Concurrency Profile 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 Max history to scan and Include open orders. MQL source code included.

Files in the download: TradeConcurrencyProfile.mq4, TradeConcurrencyProfile.txt.

Settings

SettingDefaultWhat it does
Max history to scan0Most recent closed orders to include (0 = every closed order)
Include open orderstrueAlso include currently open orders (still counted through "now")

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