EA-1539 · Utility

Exp_ToCloseProfit

This EA monitors the account's floating profit and automatically closes all open positions (both long and short) when the total unrealized profit reaches or exceeds a user-defined threshold. It uses a global variable to track whether the profit level has been triggered, ensuring that once the target is hit, all positions are closed even if profit subsequently drops below the threshold.

Open the interactive view (equity curve, symbol switch)

Key facts

CategoryUtility
RiskLow
Rating★★☆☆☆
TypeUtility tool
TimeframesM1, M5, M15, M30, H1, H4, D1
IndicatorsAccount Profit
AuthorCopyright © 2011, Nikolay Kositsin

Backtest results (H1, about 1 year)

Not backtested yet — this EA could not be converted automatically.

Strategy analysis

The core concept of this EA is an account-level profit-target closing utility rather than a traditional trading strategy. It has no entry conditions since it does not open positions on its own; it only triggers closing when the account's total floating profit reaches the configured threshold. The exit condition is triggered when AccountInfoDouble(ACCOUNT_PROFIT) equals or exceeds the MaxProfit parameter, at which point it iterates through all open positions and closes both long and short positions. Regarding position management, the EA is not involved in position establishment and only handles uniform closing, iterating from PositionsTotal()-1 downward to avoid index shifting during deletion. For money management, it uses MetaTrader global variables to lock in the profit trigger state — once profit hits the target, a flag is set to 1, ensuring positions are closed even if profit subsequently drops below the threshold, which acts as a profit-lock mechanism. However, the EA lacks sufficient slippage control, using a fixed 10-point slippage tolerance for closing, which may lead to failed closes or unfavorable execution prices in highly volatile markets.

Strengths

  • Simple and intuitive profit target management tool with clear, easy-to-understand logic
  • Uses global variables to lock the profit trigger state, preventing missed closes when profit pulls back
  • Iterates positions in reverse order to avoid index shifting, making the closing logic reasonably robust

Weaknesses

  • Fixed 10-point slippage tolerance may be insufficient in volatile markets, causing close failures
  • No position filtering mechanism — closes all positions across all symbols, lacking flexibility
  • Lacks error handling and retry logic, with no fallback if close operations fail
  • Depends on external include file TradeAlgorithms.mqh, making core closing logic opaque

Possible improvements

  • Add position filtering by symbol or magic number to avoid accidentally closing positions from other strategies
  • Add retry logic and error logging for failed close operations to improve reliability

Risk assessment

Overall risk: Low

  • Fixed slippage tolerance may cause close failures during high volatility
  • Indiscriminate closing of all positions may affect other EAs' holdings

Evaluation scores

Code quality3.0
Strategy logic2.0
Risk management3.0
Robustness2.0
Innovation1.0
Documentation2.0
Overall2.2

Parameters

ParameterDefaultDescription
MaxProfit1000.00Max profit threshold; closes all positions when floating profit reaches this value

Similar Utility EAs

Backtests are historical simulations and do not guarantee future results. Not financial advice.

Get the weekly Arena report

One email a week: ranking changes, new signals and new research. No spam; unsubscribe any time.