custom trail-stop by MA - update 4
This professional-grade solution for MetaTrader 5 helps traders achieve greater efficiency in their daily workflow. This Expert Advisor serves as automated trading software. It is utilized to monitor financial markets and execute trades based on predefined algorithmic rules, enabling precise position management without the need for constant manual oversight.
How to Setup and Use custom trail-stop by MA - update 4
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.
Description & Settings
this is my first try at creating an EA from ground up
the EA only trails, so no automatic buy/sell
***** PLEASE NOTE: the default values are adjusted for M1 time-frame, as is the easiest way i got for testing it's workings, but it works in all time-frames and currency pairs *****
besides the MA parameters, it also got a few options for the trailing
possibility of enforcing a maximum stop loss - for older orders that might exceed it
number of bars behind to use in MA trail
minimum distance from MA to trail
minimum distance of current price to trail on positive and on negative profit
possibility of not showing indicator line
trail step
the code probably can be optimized further
feel free to post suggestions, changes to the code that can improve it, or any doubts about it's workings
i have been trying to control the indicator`s appearance - line, color and style. any help will be welcome
Update 1 (V1.1)
file updated after consideration on how to treat preexisting orders that exceed max sl and the EA don`t have permission to close them
Update 2 (V1.2)
logic errors in the trail system
added possibility of hiding/showing graphic line on chart
Update 3 (V1.3)
added trail step
Update 3.1
fixed some logic errors (yes i still keep finding them ^^)
Update 4
a lot of mistakes where identified and corrected, affecting some minor changes in the trail method
coming soon: class library