Equity Lockdown
- ユーティリティ
- バージョン: 1.0
- アクティベーション: 5
Equity Lockdown is an account-level risk guard for MetaTrader 5. It does not
generate signals, predict direction or open trades. It watches your account
equity against a set of limits you define, and when a limit is breached it
cancels your pending orders, closes your open positions, and keeps the account
flat until the next trading day begins.
It acts on every position and every pending order in the terminal, whatever
opened it - this tool, another Expert Advisor, or a manual click. A guard that
only saw its own trades would protect nothing.
Four limits, each switched on or off independently
- Daily loss. Measured against the account balance at the start of the
trading day. Set it as a percentage, as a fixed amount in the account
currency, or both - whichever is reached first triggers the guard.
- Maximum drawdown. Measured against a high-water equity mark that is
stored on disk and only ever rises. It is not reset overnight, so a run of
losing days is still measured from the real peak.
- Equity floor. An absolute account value. Equity reaching that number
triggers the guard regardless of how the account got there.
- Daily profit lock. The mirror of the daily loss limit. Reaching your
target for the day closes the book and stops trading until tomorrow.
How it behaves when a limit is breached
1. An alert is raised and a line is written to the journal stating the limit,
the measured value and the threshold that was crossed.
2. Pending orders are cancelled first, then open positions are closed. That
order matters: closing positions first would leave a pending order near the
market able to fill while the account was being flattened.
3. Closing is retried, and the account book is re-read afterwards to confirm it
is actually flat. If it is not - a symbol with trading disabled, a market
that has closed - the guard says so plainly in the journal and retries on
the next check rather than reporting a safety it did not achieve.
4. The account is marked locked for the rest of the trading day. While locked,
any position that appears is closed again.
Details that matter in live use
- It is driven by a timer, not by chart ticks. A guard that woke only on
its own chart's ticks would go blind exactly when it matters - over a
weekend, or on a thin symbol - while positions on other symbols kept moving
against the account. The check interval is configurable and defaults to one
second.
- Its state survives a restart. The day-start balance, the peak equity mark
and the lockout are stored per account login and are deliberately not cleared
when the Expert Advisor is removed from the chart. Closing a chart or
restarting the terminal does not hand the account a fresh baseline and does
not quietly undo an active lockout.
- The chart it runs on is irrelevant. By default the scope is the whole
account. Attach it to any one chart; one instance is enough. An option
restricts it to the chart's own symbol if you want that instead.
- The trading day is yours to define. The rollover hour is an input, so a
day that starts at 17:00 server time is measured on its own calendar rather
than the broker's midnight.
- A dry-run mode is included. In alert-only mode the guard raises its alert
and writes its journal line but never closes anything, so you can confirm
your limits are set where you think they are before letting it act. Alert-only
deliberately does not set the lockout, so the alert keeps reflecting live
conditions.
What this tool does not do - please read before buying
- It cannot switch off another Expert Advisor's trading. MetaTrader 5
offers no way for one Expert Advisor to disable the terminal's algo-trading
toggle or to stop another program from sending orders. What Equity Lockdown does
while locked out is close whatever appears. In practice the account stays
flat, but this is a janitor rather than an interlock, and you should
understand the difference before relying on it.
- It reacts, it does not predict. It cannot prevent a loss that happens
between two checks - a gap, a spike, or a slippage-filled stop. It limits how
far a loss runs, not whether one occurs.
- It only works while the terminal is running and connected, with algo
trading enabled. It cannot act on a closed terminal or a lost connection.
- It opens no trades, so it does not produce trading results in the
Strategy Tester. To see it work in the tester, set an equity floor above the
tester deposit; the breach, the alert, the flatten and the lockout will all
appear in the log.
- It makes no claim about profitability. It is a risk limiter. Limiting
losses is not the same thing as producing gains.
Setup
Attach it to one chart, on any symbol, with algo trading enabled. Set the
limits you want and switch off the ones you do not. Confirm the arming block in
the Experts journal reads back the limits you intended - it prints the account,
the currency, the day-start balance, the peak equity and every active limit at
startup.
Note that all money limits are expressed in your account's deposit currency,
which is not necessarily USD.
