Forex EA Name: Nested Hedge and Martingale Forex EA. This EA is a loss-martingale type EA with a layered take-profit approach. When the price returns to between the first and second orders, the first and third orders are closed, leaving the second order open.
Order Entry and Closing Principles:
A Buy order is placed when a bullish candle is closed, and a Sell order is placed when a bearish candle is closed. Take profit is set at 500 pips.
Martingale multiplier for losses: For each additional order, a uniform take-profit price is set. After reaching the second order, no more orders are added, and a uniform 500-pip stop-loss is set.
When there are 3 orders in the same direction, if the price retraces between the first and second orders, the first and third orders are closed.
The take-profit and stop-loss for the second order are reset to return to a single-order state, either waiting for a take profit or waiting for a martingale.
Parameter Explanation:
Order Identifier: If multiple EAs are trading on the same instrument, it is essential to have a unique "Order Identifier" for each EA. This helps differentiate and manage their orders to avoid any logic errors.
Pips: One pip is the smallest price move in the exchange rate of a currency pair. For instance, if the price has 5 decimal places, 1 pip is equal to 0.00001. If the price has 4 decimal places, 1 pip equals 0.0001.
Same-Direction Average Take Profit Pips: This function calculates the average entry price of the same-direction orders (excluding pending orders) and then modifies the take-profit price for all orders by the specified number of pips (parameter A). Note that this function only modifies the take-profit price in the direction of the trade. The "Order Identifier" parameter determines the orders on which this function applies. If you do not wish to use this function, set "Average Take Profit Pips" to 0.
Same-Direction Average Stop Loss Pips: This function calculates the average entry price of the same-direction orders (excluding pending orders) and then modifies the stop-loss price for all orders by the specified number of pips (parameter A). Note that this function only modifies the stop-loss price in the direction of the trade. The "Order Identifier" parameter determines the orders on which this function applies. If you do not wish to use this function, set "Average Stop Loss Pips" to 0.
Martingale Multiplier: This function controls how the martingale strategy is executed. Parameters A (Interval Pips), B (Lot Multiplier), and C (Number of Additional Orders) specify how the martingale should work in case of losses (counter-trend) and gains (trend-following). When the Ask price for a BUY order is below the entry price of the lowest BUY order by more than A pips, a new BUY order is placed. Similarly, when the Bid price for a SELL order is above the entry price of the highest SELL order by more than A pips, a new SELL order is placed. The lot size for additional orders is calculated as the lot size of the previous order multiplied by parameter B. No more orders are added when the number of additional orders reaches parameter C.
Current Price Entry: BUY orders are entered at the Ask price, and SELL orders are entered at the Bid price.
Installation Instructions for Forex EA:
After purchase, copy the .ex4 file to the MQL4/Experts directory of your MT4 platform.
Restart the MT platform or in MT4, navigate to [View] - [Navigator], right-click on [Expert Advisors], and select [Refresh].
Open the currency pair chart where you want to apply the strategy. Drag and drop the strategy onto the chart. There's no need to open charts for other currency pairs.
Remember that there's no 100% accurate trading system in the world. Any excellent trading system also has periodic flaws. Having more reference signals is like having more guidance, and I wish you success as soon as possible!