Exp_ToCloseProfit - MetaTrader 5 Expert - MT4/MT5 Resources
The Expert Advisor implements a global take profit on all open positions. If the profit of the current position exceeds the maximum fixed level in the MaxProfit input parameters of the Expert Advisor, it will close all positions.
When all open positions execute the condition of exceeding the specified profit, the Expert Advisor saves information about this fact to terminal global variables and only then exits all open positions based on this information.
Why this instead of directly on the signal? The problem is that the closing process takes multiple times, which is why in real life the closing process can be interrupted for any reason. In this case, the Expert Advisor will in any case close the position due to exceeding the profit. Since all positions have been closed, the terminal global variables will be deleted!
Attachment download
📎 exp_tocloseprofit.mq5 (4.43 KB)
📎 tradealgorithms.mqh (67.74 KB)
Source: MQL5 #1539
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •