Overtrading Stopper MT5
- Utilità
-
Kosuke Noguchi
I'm an independent MT5 developer based in Japan. My products are built around clear, testable logic and
conservative risk control rather than promising high win rates or unrealistic returns.
Current products: - Versione: 1.103
- Attivazioni: 5
1. Overview
Overtrading Stopper MT5 is a MetaTrader 5 utility EA that helps discretionary traders follow their own trading rules.
You can set rules in advance, such as: how many times you may trade today, how many consecutive losses should make you stop, how many minutes to pause after a loss, and how to avoid entering several trades in rapid succession.
When a configured limit or condition is reached, the EA displays the reason for the protection state on the chart. Depending on your settings, it can close new positions or delete pending orders.
This tool is not a signal-generating EA. It does not make trading decisions. It is designed to make it easier to apply the risk-management and trading-discipline rules you decide in advance.
2. Who It Is For
Overtrading Stopper MT5 is for discretionary traders who want to:
- Keep a planned daily trade cap.
- Avoid rapid re-entry after a loss or a losing streak.
- Control entry intervals for scalping or short-term trading.
- Separate manual and EA trading with Magic Number scope.
- Apply rules per symbol or across all symbols.
- Keep the day's protection state after reattaching the EA or restarting MT5.
- Review rule activation in a CSV log.
It supports rule-based trading discipline instead of emotion-driven decisions.
3. What It Can and Cannot Do
What It Can Do
- Monitor trade count, losing streaks, entry gaps, and post-loss cooldowns.
- Show the protection reason on the chart and, when enabled, close new monitored positions or delete monitored pending orders.
- Monitor manual trades, all trades, or a specified Magic Number; monitor the current chart symbol or all symbols.
- Save and restore the lock state and active cooldown after EA reattachment or MT5 restart.
- Record important events in a CSV log.
Limits and Requirements
- It does not generate signals or guarantee profit, win rate, or loss avoidance.
- It cannot reject a manual order before placement; it detects the order afterward and performs enabled actions.
- Closing or deletion can be affected by connectivity, broker conditions, and trading hours.
- Keep MT5 or a VPS running and enable Algo Trading while using protection actions.
Confirm suitability on a demo account before purchase or live use.
4. Main Features
Daily Trade Limit
The EA counts new entries in the monitored scope and enters the protection state when the specified limit is reached.
Set a limit that fits your trading rules, such as "up to five trades per day" or "three trades during the London session." The daily reset time is set in your broker's server time.
Losing Streak Limit
The EA enters the protection state when consecutive losing closed trades in the monitored scope reach the specified number.
For example, set the limit to 3 when you want to review your trading for the day after three consecutive losses.
Minimum Entry Gap
The EA enters the protection state when consecutive entries are made closer together than the specified interval.
This is useful if you tend to repeat orders in a short time. For example, with a setting of 10 minutes, the EA detects a new monitored entry made less than 10 minutes after the previous monitored entry.
Loss Cooldown
After a losing trade closes, the EA keeps the protection state active for the specified time.
The chart panel shows the remaining cooldown time. For example, a setting of 30 minutes applies the configured protection actions for 30 minutes after a losing trade closes. Set it to 0 to disable this feature.
Selectable Protection Actions
You can choose each action to apply after the protection state starts:
- Close new positions.
- Delete new pending orders.
- Also delete pending orders that already existed before protection started.
These settings let you choose between stronger protection and preserving your existing trade plan as much as possible.
Monitoring Scope
Choose whether to monitor only the current chart symbol or all symbols.
You can also use the Magic Number condition to monitor manual trades only, all trades, or trades from a specific EA only.
Status Panel and CSV Event Log
The on-chart status panel shows the current status, entry count, losing streak, cooldown, monitoring scope, protection reason, and enabled protection actions.
The CSV event log records important events. Use it to confirm why protection was triggered, what action was taken, and whether settings should be reviewed.
Protection-State Persistence
The current day's lock state and any active post-loss cooldown are saved.
If you remove and reattach the EA or restart MT5, the saved protection state is restored when the account, monitoring scope, and Magic Number settings are the same. The day's state is cleared at the daily reset time.
5. What Happens When Protection Is Active
The protection state becomes active when any of the following conditions is met:
- The daily trade limit is reached.
- The losing streak limit is reached.
- Consecutive entries closer than the minimum entry gap are detected.
- A post-loss cooldown is active.
The chart panel displays the reason when protection is active.
The subsequent behavior is determined by the Protection Actions settings.
Close new positions after protection starts
When enabled, the EA closes monitored positions opened after protection starts.
Positions that were already open before protection started are not closed by this setting alone.
Delete new pending orders after protection starts
When enabled, the EA deletes monitored pending orders created after protection starts.
Use this when you want to preserve pending orders already included in an existing trading plan but delete only pending orders newly placed after the lock.
Also delete existing pending orders
When enabled, the EA also deletes monitored pending orders that existed before protection started.
This provides stronger protection, but it also makes previously placed limit and stop orders eligible for deletion. Enable it only after understanding this effect.
6. Initial Settings Example
Start with conservative settings that minimize effects on existing positions and pending orders.
Daily trade limit: 5 (Maximum number of monitored entries allowed before the daily reset.)
Losing streak limit: 3 (Protection starts when this number of losing closed trades occurs consecutively.)
Minimum entry gap: 10 minutes (Detects consecutive entries made closer together than this interval.)
Loss cooldown: 30 minutes (Time to keep protection active after a losing trade closes.)
Close new positions: false (Closes monitored positions opened after protection starts.)
Delete new pending orders: true (Deletes monitored pending orders created after protection starts.)
Delete existing pending orders: false (Also deletes monitored pending orders that existed before protection started.)
Symbols to monitor: Current chart (Monitors only the symbol of the chart where the EA is attached.)
Magic scope: 0 (Magic Number scope: 0 monitors manual trades.)
Daily reset hour: 0 (Hour to reset the day's state in broker server time.)
These settings manage manual trading with a five-trade limit, a three-loss streak limit, a 10-minute entry gap, and a 30-minute post-loss pause. Existing open positions are kept, while new pending orders are deleted after protection starts. Confirm the behavior on a demo account before live use.
7. How to Use It
1. Check Before Use
First test the EA on a demo account, not on your live trading account.
Keep MT5 or a VPS running and enable Algo Trading on the toolbar while using EA protection actions. When Algo Trading is disabled, the EA cannot close positions or delete pending orders.
Also decide in advance which trades to monitor.
- To monitor manual trades only, set Magic scope to 0.
- To monitor all trades, set Magic scope to -1.
- To monitor only a specific EA, set that EA's Magic Number.
2. Attach the EA to a Chart
- Open a chart in MT5. When using Current chart, open the chart of the symbol you want to monitor.
- Drag and drop Overtrading Stopper MT5 from the Navigator onto the chart.
- On the Common tab, enable "Allow Algo Trading."
- Set the required values on the Inputs tab.
- Confirm that the EA icon appears in the chart's upper-right corner and that the status panel appears on the chart.
To monitor all symbols, attach the EA to any one chart and set Symbols to monitor to All symbols.
3. Set Your Trading Rules
First, set your rules under Discipline Limits.
- Enter the maximum number of monitored entries per day in Daily trade limit.
- Enter the number of consecutive losses after which you want to stop in Losing streak limit.
- Enter, in minutes, the interval you want to require between consecutive entries in Minimum entry gap.
- Enter, in minutes, how long you want to pause after a losing trade in Loss cooldown. Set 0 when you do not want to use it.
- Enter the time to reset daily counts and protection state in Daily reset hour, based on broker server time.
Start with the example in section 6. After you understand the behavior, change the values to match your own rules.
4. Choose Protection Actions
Under Protection Actions, choose what the EA should do after protection starts.
- Set Close new positions after protection starts to false if you want to keep positions that are already open.
- Set Delete new pending orders after protection starts to true if you want to delete pending orders added after protection starts.
- Set Also delete existing pending orders to true only if you also want to delete pending orders that existed before protection started.
For first use, the following conservative settings are recommended: Close new positions after protection starts = false, Delete new pending orders after protection starts = true, and Also delete existing pending orders = false.
5. Check the Monitoring Scope
Symbols to monitor and Magic scope are important settings because they determine which trades protection actions can affect.
- With Symbols to monitor set to Current chart, only the symbol of the chart where the EA is attached is monitored.
- With Symbols to monitor set to All symbols, trades on all symbols matching the monitored Magic Number are included.
- With Magic scope set to 0, ordinary manual orders are monitored.
- With Magic scope set to -1, all trades, including manual and EA orders, are monitored.
- With a positive number in Magic scope, only EA orders with that Magic Number are monitored.
Especially when using All symbols or Magic scope = -1, verify on a demo account that unintended trades are not included.
6. Check the Status Panel
When the EA is attached, a status panel appears on the chart. Check at least the following:
- Whether the current status is OK or protection is active.
- The symbol scope and Magic Number scope being monitored.
- Today's entry count and losing streak.
- The remaining time when a loss cooldown is active.
- The reason protection started.
- Whether closing new positions and deleting pending orders are enabled.
If the text is too small or too large, adjust Status panel text size. To hide the panel, set Show status panel on chart to false.
7. Verify Protection on a Demo Account
Before live use, verify at least the following on a demo account:
- Open a small monitored trade and confirm that the entry count appears on the panel.
- Create conditions that trigger Daily trade limit or Minimum entry gap, and confirm that the status changes to the protection state.
- When using Loss cooldown, close a monitored trade at a loss and confirm the cooldown starts and its remaining time is displayed.
- When Delete new pending orders after protection starts is enabled, create a monitored pending order after protection starts and confirm that it is deleted.
- When using Close new positions after protection starts, always confirm its behavior on a monitored new position in a demo account.
- Remove and reattach the EA and confirm that the protection state or cooldown is restored.
When changing settings, check the monitoring scope and protection actions shown on the chart panel again.
8. Check the CSV Log
When Write CSV event log is set to true, the event log is saved in the following file inside the MT5 data folder:
MQL5\Files\OvertradingStopperMT5_log.csv
After demo testing, check this CSV for records such as LOCK, COOLDOWN_START, COOLDOWN_END, RESET, STATE_RESTORED, position closes, and pending-order deletions.
9. Daily Use
Before trading, check the chart panel for the monitored scope, today's trade count, and enabled protection actions. The saved state is restored after reattachment or restart, but resets at the configured daily reset time.
8. Parameter Details
Discipline Limits
- Daily trade limit: maximum monitored entries in one daily reset period.
- Losing streak limit: consecutive monitored losing closed trades that activate protection.
- Minimum entry gap (minutes): entries closer than this interval activate protection.
- Loss cooldown (minutes, 0 = off): protection time after a losing trade closes; 0 disables it.
Protection Actions
- Close new positions after protection starts: closes monitored positions opened after protection starts, not already-open positions.
- Delete new pending orders after protection starts: deletes monitored pending orders created after protection starts.
- Also delete existing pending orders: also deletes monitored pending orders that existed before protection started.
- Symbols to monitor: Current chart or All symbols.
- Magic scope (-1 all, 0 manual, >0 EA): all eligible trades, manual trades, or one EA Magic Number.
- Daily reset hour (server time): broker-server hour that resets daily count, losing streak, and lock state.
Display and Event Log
- Write CSV event log: records initialization, locks, resets, cooldowns, closes, and pending-order deletions.
- Show status panel on chart: shows the monitoring and protection state.
- Status panel text size: adjusts panel font size.
9. Usage Examples
Example 1: Limit Daily Manual Trades
Use these settings when your rule is "up to five trades per day."
Daily trade limit: 5 Losing streak limit: 0 or a value you do not use Minimum entry gap: 0 or a value you do not use Loss cooldown: 0 Symbols to monitor: Current chart Magic scope: 0
This is suitable when you mainly want to manage trade count. Choose what happens after protection starts under Protection Actions.
Example 2: Pause for 30 Minutes After Three Consecutive Losses
Use these settings when you want to avoid trading immediately after a losing streak and make time to review the market and your decisions.
Losing streak limit: 3 Loss cooldown: 30 minutes Close new positions: false Delete new pending orders: true Delete existing pending orders: false Magic scope: 0
This is a conservative setting that deletes only pending orders added after protection starts.
Example 3: Reduce Rapid-Fire Entries
Use these settings when you want to avoid emotional consecutive entries during scalping or other short-term trading.
Minimum entry gap: 10 minutes Loss cooldown: 15 minutes Magic scope: 0
When consecutive entries less than 10 minutes apart are detected, protection becomes active and a 15-minute cooldown begins.
Example 4: Monitor Only a Specific EA
Use these settings when you use several EAs and want to impose trading limits only on the EA with a specific Magic Number.
Symbols to monitor: All symbols Magic scope: 12345 Daily trade limit: 10
In this case, only trades with Magic Number 12345 are monitored. Manual trades and EA trades with other Magic Numbers are excluded.
10. State Persistence, Daily Reset, and CSV Log
The EA saves the day's lock state and active cooldown end time. It restores them after EA reattachment, an MT5 restart, or a chart reopen when the account, scope, and Magic Number settings match.
Daily trade count, losing streak, and lock state reset at the broker server time set in Daily reset hour.
With CSV logging enabled, this file records initialization, restoration, resets, protection activation, cooldown start/end, position closes, pending-order deletions, and deletion failures:
MQL5\Files\OvertradingStopperMT5_log.csv
Use the log for setting review, demo confirmation, or support requests.
11. Notes and Operating Requirements
- Always confirm behavior on a demo account before first use.
- Keep MT5 or a VPS running while using EA protection actions.
- Enable Algo Trading in MT5.
- A connection loss, broker trading halt, or symbol trading conditions may prevent a position close or pending-order deletion from completing immediately.
- Manual orders are detected after placement. This is not a feature that locks the order window before an order is sent.
- Confirm the symbol and Magic Number scope before enabling Close new positions or pending-order deletion.
- When Also delete existing pending orders is enabled, monitored pending orders placed before protection started are also eligible for deletion.
- The daily reset time uses broker server time and can differ from your PC's local time.
- Perform sufficient demo testing for your actual trading environment, account type, and symbol specifications.
12. Support and Updates
For questions, feature clarifications, or problem reports, contact us through MQL5 product comments or MQL5 messages. Include MT5 build, broker and account type, symbol, settings, issue time, relevant Experts/Journal messages, CSV rows, and steps to reproduce.
Future updates are distributed through MQL5 Market. Back up current settings or logs before updating if needed.
13. Free Demo Version: What It Can and Cannot Do
The free demo runs only in the MT5 Strategy Tester.
- Review and change the input parameters.
- Use visual mode to view the on-chart status panel.
The demo does not run on a normal chart. Live-chart monitoring, protection actions for manual or pending orders, and state restoration after EA reattachment or an MT5 restart should be confirmed with the full Market version on a demo account first.
