Break-Even Stop Mover with Locked Profit Protection
Info
The Break-Even Stop Mover with Locked Profit Protection is a Expert Advisor for MetaTrader 5 that break-even stop mover with locked profitthis is a utility expert advisor designed to protect open trading positions. Functionality:When a position for the current chart symbol reaches a specified profit level (InpTrigger points), the Expert Advisor automatically moves the stop loss to the entry price plus an additional profit buffer (InpLock points).
Usage
This tool is typically used for automated trading on major forex pairs and gold.
Platform
This Expert Advisor works exclusively on MetaTrader 5 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL5/Experts folder via File ? Open Data Folder in MetaTrader 5.
How to Install and Use Break-Even Stop Mover with Locked Profit Protection
1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.
2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.
3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.
4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.
Frequently Asked Questions
Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.
Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.
Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.
What this tool does
Break-Even Stop Mover with Locked ProfitThis is a utility Expert Advisor designed to protect open trading positions.
Typical Use Case
This Expert Advisor excels in automated trading and technical analysis on MetaTrader 5.
Compatible Platform & Setup
This Expert Advisor works on MetaTrader 5. Place the file in the MQL5/Experts folder and restart the terminal.
Description & Settings
Related: Risk Calculator: Lot Size Calculation by Risk Percentage and ATR Stop - another powerful expert for MetaTrader 5 traders.
Break-Even Stop Mover with Locked ProfitAlso recommended: Break-even and Trailing Stop Manager - similar expert with strong performance on MetaTrader 5.
This is a utility Expert Advisor designed to protect open trading positions.
Functionality:
When a position for the current chart symbol reaches a specified profit level (InpTrigger points), the Expert Advisor automatically moves the stop loss to the entry price plus an additional profit buffer (InpLock points).
Once the stop loss is moved to this break-even plus buffer level, the trade can no longer result in a loss, with the exception of potential price gaps or slippage.
This EA operates on positions that are already open. It can manage trades initiated manually, through a mobile device, or by another Expert Advisor. It does not open new trades or close existing ones.
Operational Details:
The EA monitors open positions for the chart symbol on every incoming tick and also performs a check once per second using a timer.
Profit calculation is based on points from the opening price. For buy positions, profit is measured against the Bid price, and for sell positions, against the Ask price, reflecting the price at which the position would be closed.
A new stop loss is only set if it offers an improvement over the current stop loss; it will never move the stop loss backward. Positions that already have a stop loss set at or beyond the break-even point are not altered.
The EA respects the symbol's defined stop level (SYMBOL_TRADE_STOPS_LEVEL) and freeze level (SYMBOL_TRADE_FREEZE_LEVEL). Any existing take profit levels remain unchanged.
In instances where a broker rejects a stop loss modification, the EA will pause its attempts for a set duration (InpRetrySec seconds) before retrying. This prevents the broker's log from being excessively filled with rejection messages.
A visual status panel is displayed on the chart, consisting of three lines. This panel shows the current EA settings, the number of positions being managed, the number of positions currently at break-even, and the details of the last action performed by the EA.
Input Parameters:
InpTrigger: (Default: 200) The profit in points required to activate the stop loss move.
InpLock: (Default: 20) The additional profit in points to be locked in beyond the entry price. This value must be less than the InpTrigger value.
InpMagic: (Default: -1) Specifies which trades the EA should manage. -1 manages all positions, 0 manages manual trades only, and any other positive integer manages trades opened by an EA with that specific magic number.
InpRetrySec: (Default: 60) The number of seconds to wait before retrying a stop loss modification after a broker rejection.
InpPanel: (Default: true) A boolean value to enable or disable the display of the status panel on the chart.
Notes:
Distances are measured in points according to the symbol's specification. For example, on XAUUSD with 2 decimal places, 100 points is equivalent to a price change of 1.00 USD. On EURUSD with 5 decimal places, 10 points is equivalent to 1 pip.
To use this EA, attach it to one chart for each symbol you wish to protect and ensure that Algo Trading is enabled in your terminal settings.
The accompanying image serves as an illustration of the EA's function, not a depiction of actual trading outcomes.
For advanced features such as trailing stops (point-based or ATR-based), partial position closing, initial stop loss/take profit settings, and management of all symbols simultaneously, please refer to the 'Stop Pilot Trade Manager' available on the Market.
You may also like: Lot From Risk: Calculate Position Size Based on Risk, Stop Loss, and Commission - excellent alternative for expert users on MetaTrader 5.
Source Code
#property copyright "RobotFX"
#property version "1.00"
#property description "This code is educational. Feel free to use, modify and upgrade as you wish. Visit ROBOTFX.ORG for professional trading tools"
#include <Trade\Trade.mqh>
input int InpTrigger = 200;
input int InpLock = 20;
input long InpMagic = -1;
input int InpRetrySec = 60;
input bool InpPanel = true;
#define PFX "BEM_"
.......
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.