Close on Profit or Loss in Account Currency - Expert Advisor Update
Hey traders! If you’re looking to streamline your trading strategy, you’ll want to check out the latest version of the Close on Profit or Loss in Account Currency Expert Advisor for MetaTrader 4. Here’s what’s new:
- Error Handling: This update includes robust error handling to manage situations where orders can't be closed or deleted.
- Code Optimization: We’ve cleaned up the code to make it more efficient and easier to read.
- Increased Efficiency: Unnecessary loops and computations have been removed, enhancing the overall performance.
- Clean Slate: All chart objects will now be cleared upon EA deinitialization.

When you set the EA to 0, it won’t take any action. Remember, for the Positive Closure in Account Currency to trigger, it must be greater than your current equity. For example, if your equity is $55,000, set the Positive Closure to $55,500 to lock in a $500 profit.
Example: If your equity is $55,000 and you set the Positive Closure to $55,500, it will execute immediately if it falls below that amount.
On the flip side, for the Negative Closure in Account Currency, it should be lower than your current equity to avoid immediate execution. For instance, if your equity is $55,000, set the Negative Closure to $54,500 to limit your loss to $500.
Example: If your equity is $55,000 and the Negative Closure is set to $54,500, it will execute immediately if it goes above that value.
To avoid spread spikes, consider adjusting the spread number, but keep in mind that the market can be unpredictable, leading to higher gains or losses. Also, if the spread is set lower than the average for the pairs you’re trading, those positions won’t be executed.
WARNING: Use this software at your own risk. The Forex market is known for its volatility!
#property copyright "Copyright 2024, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.01" #property description "persinaru@gmail.com" #property description "IP 2024 - free open source" #property description "This EA closes all trades on Profit and Losses calculated in Account Currency." #property description "WARNING: Use this software at your own risk." #property description "The creator of this script cannot be held responsible for any damage or loss." #property strict #property show_inputs
Here’s a quick summary of the inputs:
- Closures: EA closes all trades and pending orders when a profit or loss is reached, calculated in Account Currency.
- Positive Closure in Account Currency: Set this to your desired profit level (default is 0).
- Negative Closure in Account Currency: Set this to your acceptable loss level (default is 0).
- Spread: Default is set to 10.
Happy trading, and may your profits be plentiful!
Related Posts
- Creating an Expert Advisor for Dark Cloud Cover and Piercing Line Patterns with CCI Confirmation
- Harnessing MQL5 Wizard for Trading Signals: 3 Black Crows & 3 White Soldiers with MFI
- Creating a Stochastic-Based EA for Hammer and Hanging Man Patterns in MetaTrader 5
- Mastering Trading Signals with MQL5 Wizard: Bullish and Bearish Engulfing Strategies
- Leveraging MQL5 Wizard: Crafting Trade Signals with Meeting Lines and Stochastic