You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: Building a Basket Order Manager in MQL5 for Correlated Position Groups.
The article's system introduces CBasketManager: positions are grouped by a comment‑based basket ID, analyzed as a single snapshot, and controlled with a unified equity stop. CBasketScanner computes aggregate P&L and volume‑weighted pip performance; CBasketStopRegistry triggers coordinated closure on threshold breach; CBasketExecutor adapts to the broker's filling mode. A lightweight dashboard shows live legs, volumes, stops, and distances for faster basket decisions.
MetaTrader 5 treats every open position independently. This creates a practical problem for traders running correlated baskets. Examples include three USD pairs during a fundamental dollar move or a gold position hedged against equity longs. There is no native way to sum floating P&L across a group, no way to say "close everything when the basket loses $200," and no coordinated close mechanism. Closing a basket manually means selecting each position and clicking close individually, during which price can move between the first and last execution.
This article builds CBasketManager. The class groups positions by a basket identifier stored in the position comment, tracks aggregate floating P&L and volume, applies a unified equity stop for the whole basket, and closes all legs in a coordinated sequence. The system splits into four focused components: a scanner that reads positions, an executor that sends orders, a stop registry that monitors thresholds, and a dashboard that renders live state as a chart comment. The demo EA opens legs across two symbols — EURUSD and a configurable gold symbol — to demonstrate the engine managing positions on different instruments simultaneously.
Author: Ushana Kevin Iorkumbul