Idea by:ย
mq5 code by:ย
An EA based on technical indicators:
- iADX (Average Directional Movement Index, ADX) for the movement strength direction.
- iMACD (Moving Average Convergence/Divergence, MACD) for identifying the movement direction;
Transactions are made when the basic and signal MACD lines move upwards (for buying) and downwards (for selling). In this case, the indicators must be in the same direction at a certain number of bars: For ADX, it isย ADX: bars interval; for MACD, it is MACD: bars interval.
In both cases, the main ADX line must move upwards and be above the value of 20 (ADX: minimum).
Closing a half of the position lot size (Take half the profit) and trailing have been realized.
Please note parameter Take half the profit. If you setย Take half the profit for true, then theย Take Profit of the position will not be placed (if evenย Take Profit is set for above zero). Instead, Take Profit will work as a step to take a half of the profit. The picture below demonstrates well howย Take half the profit works:
Taking a half of the profit works only once. Then the position will be closed by triggering the Stop Loss.