Watch Risk Gate
- ユーティリティ
-
Sinmiloluwa Daniel Ogunmola
MQL5 developer focused on EAs that survive real brokers, not just the tester. - バージョン: 1.0
- アクティベーション: 5
Account guard that closes positions and blocks new ones for the rest of the day once your daily loss or daily gain limit is reached.
Most accounts are not lost on one bad trade but on the trades taken after it. MetaTrader lets you set a stop loss per position, but it has no hard limit for the whole day, so one emotional afternoon or one misbehaving Expert Advisor can undo weeks of work. A rule you keep in your head is easy to break when you are under pressure.
Watch Risk Gate turns the daily limit into something the terminal enforces. It records the account value at the start of each trading day and checks it on every tick. When the day's loss reaches your limit, or the day's gain reaches your lock level, the gate shuts: it closes the positions it manages and, while shut, closes any new position in scope until the next trading day starts.
- Daily loss limit and daily gain lock, each in percent, each can be turned off.
- Day start measured on equity or balance, at a server hour you choose.
- Scope: all positions, one magic number, or the chart symbol only, so it can guard manual trading or a single Expert Advisor.
- Optional caps on lot size per position and on the number of open positions.
- The day start and gate state survive a terminal restart (terminal global variables).
- Closing respects the broker freeze level.
- A chart panel shows the day start value, the current result and the gate state.
The utility does not use DLLs, web requests or external services, and it behaves the same on every account type and server.
Recommended symbols and timeframes: Any symbol and any timeframe. Attach it to one chart only per account (with InpScope = all positions), or to one chart per symbol when using the symbol scope. Keep the terminal running while you trade; the gate acts only while it is attached and AutoTrading is enabled.
Inputs:
- Daily Limits: InpDailyLossPct (10.0) - daily loss limit % (0 = off)
- Daily Limits: InpDailyGainPct (15.0) - daily gain lock % (0 = off)
- Day Start: InpBasis (Equity) - value used at day start: equity or balance
- Day Start: InpDayStartHour (0) - server hour the trading day starts (0-23)
- Gate Behaviour: InpCloseOnBreach (true) - close in-scope positions when the gate shuts
- Gate Behaviour: InpBlockAfterBreach (true) - while shut, close any new in-scope position
- Scope: InpScope (All) - all positions, one magic number, or this symbol
- Scope: InpMagicFilter (0) - magic number, used only with the magic scope
- Caps: InpMaxLotsPerTrade (0) - 0 = off; in-scope positions above this volume are closed
- Caps: InpMaxOpenPositions (0) - 0 = off; newest in-scope positions beyond this count are closed
Risk disclaimer: Trading leveraged products carries a high level of risk and you can lose more than your deposit. Watch Risk Gate reduces exposure according to your settings but cannot prevent losses: positions are closed at market, so slippage, gaps, weekends, disconnections or a closed terminal can produce a loss larger than the limit. It only works while MetaTrader is running with AutoTrading enabled. Test it on a demo account first.
