Basket Manager EA
This EA monitors open positions and closes all positions as a basket when the total count reaches a threshold and the account equity exceeds the balance. On the nth deal entry, it also closes all other positions leaving only the newly opened one. It does not open any positions on its own.
Open the interactive view (equity curve, symbol switch)Key facts
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 'basket management' — treating all open positions as a single portfolio. For entry conditions, the EA does not execute any entries itself; it relies on external signals or other EAs to open positions. Exit conditions are twofold: first, in OnTick, when the position count reaches or exceeds parameter n and account equity exceeds balance, all positions are closed for an overall profit; second, in OnTradeTransaction, when position count exactly equals n and equity is not below balance, if a new entry deal is detected, all other positions are closed while keeping only the newly opened one. For position sizing, the EA does not adjust lot sizes or add positions. For money management, it only uses the equity-versus-balance comparison as the profit criterion, without setting stop-loss, take-profit, or drawdown controls. The overall logic is simple but has serious flaws: the while loop for closing positions one by one could lead to infinite loops if a close fails, and there is no handling for slippage, requotes, or other trading exceptions.
Strengths
- Simple and clear concept, easy to understand and deploy
- Basket closing approach helps lock in overall portfolio profit
- OnTradeTransaction event-driven response is timely, quickly clearing excess positions
Weaknesses
- While loop for closing positions has no failure exit condition, potentially causing infinite loops or even account blowup
- No stop-loss or take-profit set, floating losses are never cut
- Using PositionGetTicket(0) in a loop may skip or repeat positions as the list shifts after each close
- No check on PositionClose return value, impossible to know if close succeeded
- No filtering by symbol or magic number, closes all positions including those from other EAs
Possible improvements
- Add a maximum iteration limit to the while loop and a retry/exit mechanism after each close attempt
- Add magic number and symbol filtering to avoid accidentally closing other EAs' positions
- Add stop-loss and maximum drawdown protection mechanisms
Risk assessment
Overall risk: High risk
- While loop without exit condition may cause infinite loop freezing the EA
- Unhandled close failures may leave positions open when they should be closed
- No magic number filter closes all EAs' positions causing unintended losses
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
n | 3 | Position count threshold to trigger basket close |
Similar Utility EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.