Trailing Stop and Take Expert Advisor
Info
The Trailing Stop and Take Expert Advisor is a Expert Advisor for MetaTrader 5 that this expert advisor (ea) is designed for trailing stop-loss and take-profit orders of open positions. The EA operates on hedging accounts, and its principle of operation is as follows: when a new position is opened, the EA checks for existing stop orders.
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 Trailing Stop and Take Expert Advisor
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
This expert advisor (EA) is designed for trailing stop-loss and take-profit orders of open 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: EMA Cross EA with ATR Stops for MetaTrader 5 - another powerful expert for MetaTrader 5 traders.
This expert advisor (EA) is designed for trailing stop-loss and take-profit orders of open positions.Also recommended: Safe Risk Manager EA - Daily Loss, Break-Even, and Trailing Stop Management - similar expert with strong performance on MetaTrader 5.
The EA operates on hedging accounts, and its principle of operation is as follows: when a new position is opened, the EA checks for existing stop orders. If none are found, it sets a stop order at a specified distance, as defined in the EA parameters. Subsequently, the EA begins to adjust the position's take-profit and/or stop-loss orders based on price movements, provided they exceed the specified distance in the settings.
Users can customize the position type (any/buy/sell), symbol (any or specific), magic number (any or specific), and ticket (any or specific). Additionally, the EA offers the option to enable trailing in the losing area; if disabled, stop orders will not be trailed when the position is in a loss.
The breakeven value can be set in the EA parameters, and to test the trailing functionality in various scenarios, the EA can open positions on each new bar, but this feature is limited to the strategy tester.
The EA includes 12 input parameters:
- Initial Stop Loss Size in Points (0 for no stop): If a position lacks a stop loss, the EA adds one with the specified value immediately after opening. A value of 0 means no stop loss will be placed.
- Initial Take Profit Size in Points (0 for no take): If a position has no take profit, the EA adds one with the specified size after opening. A value of 0 means no take profit will be placed.
- Trailing Stop Size in Points (0 for no trail): The trailing parameter for stop loss, indicating the distance from the price. A value of 0 means stop loss will not be trailed.
- Trailing Take Size in Points (0 for no trail): The trailing parameter for take profit, indicating the distance from the price. A value of 0 means take profit will not be trailed.
- Positions Type: The type of positions to trail.
- Positions Symbol (empty for any symbol): The symbol of positions to trail; an empty value includes all symbols.
- Positions Magic Number (0 for any magic): The magic number of positions to trail.
- Position Ticket (0 for all tickets): The ticket of positions to trail.
- Trailing Step: The trailing step; if the price moves beyond the stop order by a distance greater than the step, the stop order is modified to the size specified in the settings.
- Trailing in the Unprofitable Zone: Enable or disable trailing in the losing area. When disabled, stop orders are not set in the loss zone.
- Breakeven in Points: The breakeven value, below which the losing area begins.
- Spread Multiplier: A multiplier for the spread used to calculate the minimum distance for placing stop orders, addressing the issue of floating stoplevel.
You may also like: One-Click Trade Manager: Risk-Based Lot Sizing with Integrated Entry, Stop, and Target - excellent alternative for expert users on MetaTrader 5.
Source Code
/
.......
⚠ 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.