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: A Reusable Breakeven Manager in MQL5 with Spread Compensation.
A robust breakeven implementation for MQL5 is built around live spread sampling and correct pip-to-price conversion by symbol digits. CBreakevenManager moves SL to open_price ± spread ± buffer once a real‑pip activation threshold is reached and prevents duplicate modifications. A demo EA shows the behavioral difference versus a naive breakeven, and a script verifies core calculations.
You may have seen a familiar failure mode: an Expert Advisor moves a stop-loss "to breakeven" at the entry price and then, during a short spread spike (news or thin liquidity), the position is closed on that stop even though the market is barely retraced. The root causes are twofold and engineering-focused: (1) a breakeven check that ignores the fact that a trade is opened at ask but closed at bid—so the spread at modification time must be part of the breakeven level—and (2) a mistaken pip/point conversion on 3- and 5-digit symbols, which makes activation thresholds and buffers scale incorrectly. You need a small, testable module that (a) measures profit in real pips, (b) samples the live spread at the instant of modification, and (c) sets SL to open price ± current spread ± buffer (with pip size derived from the symbol's digits). This article implements exactly that: a CBreakevenManager with a clear API (Register(ticket, activation pips, buffer pips) and OnTick()), demo EA, and verification script.
Author: Ushana Kevin Iorkumbul