Author of the Idea: arist0
MQL5 Code Author: barabashkakvn
Today, let's dive into the Breakdown EA, a powerful tool designed for trading with pending Buy Stop and Sell Stop orders. Each day, this EA clears out any pending orders left over from the previous day before setting new ones. It strategically places these orders at a minimum distance above the prior day's High and below the Low.
When one of these pending orders gets triggered and starts to show profit, the EA automatically applies a trailing stop to lock in those gains.
It's worth noting that once a pending order is activated, the remaining pending order is removed. This is handled in the OnTradeTransaction function, where it looks for a market entry (DEAL_ENTRY_IN).
Inputs
- Stop Loss - Set your stop loss level;
- Take Profit - Define your take profit target;
- Trailing Stop - Activate trailing stops;
- Trailing Step - Specify the trailing step;
- Minimum Distance - Set the minimum distance from the High and Low of the previous day;
- Risk in Percent for a Deal from Free Margin - Determine your risk per trade;
- Magic Number - Assign a unique identifier for the EA.
Example: EURUSD, M15:

Related Posts
- Creating an Expert Advisor for Dark Cloud Cover and Piercing Line Patterns with CCI Confirmation
- Creating a Stochastic-Based EA for Hammer and Hanging Man Patterns in MetaTrader 5
- Harnessing MQL5 Wizard for Trading Signals: 3 Black Crows & 3 White Soldiers with MFI
- Mastering Trading Signals with MQL5 Wizard: Bullish and Bearish Engulfing Strategies
- Creating Powerful Trade Signals with MQL5 Wizard: Bullish and Bearish Engulfing Patterns + RSI