Spectar Daily Loss Limiter
- 유틸리티
- 버전: 1.1
Spectar Daily Loss Limiter is a small, free risk utility for MetaTrader 5. It does exactly one thing: it enforces a daily loss limit that you choose.
Many traders know their daily limit but break it after a bad trade. Many prop-firm style evaluations also measure the daily loss from the broker server's midnight and count floating (open) profit and loss, not only closed trades. This tool follows the same logic, so you can see in real time how much room you have left today.
How it works
1. At the daily reset (broker server time, midnight by default) the EA stores the start-of-day value: the start-of-day balance, or the higher of start-of-day balance and equity.
2. On every tick, every trade event and once per second it calculates today's loss: start value minus current equity (floating P/L included), or closed P/L only if you prefer.
3. When today's loss reaches your limit minus a small safety buffer, the day locks:
- all open positions are closed (all symbols, or only one magic number),
- all pending orders are deleted,
- the lock is saved in the terminal, so it stays active if you restart the EA or the terminal.
4. While the day is locked, any new position is closed immediately and any new pending order is deleted.
5. The lock lifts automatically at the next daily reset.
An on-chart panel shows the start value, today's loss, the limit, the room left, the status (OK / LOCKED) and the next reset time (server time).
Please read: what this tool cannot do
- It cannot physically block manual trading. MetaTrader 5 does not let an Expert Advisor disable the trade buttons. While locked, the EA closes new positions as soon as it sees them (normally within a fraction of a second, at most about 1 second). Each such trade can still cost you spread, commission and slippage.
- It only works while it is running. The terminal must be open and connected, the EA attached to a chart and Algo Trading enabled. If the PC, terminal or connection is down, nothing is enforced. A VPS is recommended. The panel shows a warning when Algo Trading is off.
- Closing is not guaranteed at your exact limit. Market orders can slip, and gaps (weekend, daily break, news), low liquidity or a closed market can make the final loss larger than the limit. The safety buffer helps, but it is not a guarantee. If the market is closed, the EA keeps retrying every second.
- It does not guarantee you pass any evaluation or follow any firm's rules. Each firm defines daily loss in its own way (reset time, base value, inclusion of commissions). Check your rules and set the inputs to match, ideally a bit stricter.
- It does not trade, gives no signals and makes no profit. It is a discipline and risk-control tool only.
- Removing the EA from the chart, or deleting its terminal global variables, removes the protection. It is designed against impulsive decisions, not against a determined user.
Features
- Daily loss limit in money and/or percent (when both are set, the stricter one is used)
- Base: start-of-day balance, or the higher of start-of-day balance / equity
- Daily reset hour in broker server time (0 = server midnight)
- Floating P/L included (prop-firm style) or closed P/L only
- Safety buffer: acts slightly before the limit to allow for slippage
- Closes all positions on all symbols, or only positions with one magic number
- Deletes pending orders
- Persistent lock for the rest of the day (survives EA and terminal restart, and changing the inputs)
- Instantly closes positions opened while locked
- Hedging and netting accounts
- Retries on requote / busy / price changed, automatic filling-mode fallback, splits volumes above the symbol maximum
- Deposits and withdrawals made today are not counted as profit or loss (option)
- No DLLs, no web requests, no hard-coded symbol
About the Strategy Tester
On a live or demo account this utility never opens a trade. In the Strategy Tester nobody places trades, so the EA opens small demo positions on the chart symbol (one at a time, about 5 % of free margin, held for 240 minutes by default) to show the daily lock at work. The backtest result therefore says nothing about profit — it only shows the lock. You can switch this off with the input "Tester: open demo trades"; these two inputs have no effect outside the tester.
Inputs
- Daily loss limit, money (default 0 (off)): Limit in account currency. 0 = not used.
- Daily loss limit, % of base (default 3.0): Limit as % of the base value. 0 = not used. If both are set, the stricter applies.
- Base for % limit and loss (default Start-of-day balance): Or "Higher of start-of-day balance / equity".
- Safety buffer, % of base (default 0.10): The lock triggers this much before the limit (slippage reserve).
- Day reset hour, SERVER time (default 0): 0 = broker server midnight. 0-23.
- Include floating P/L (default true): true = loss is measured on equity (open trades count). false = closed trades only.
- Ignore deposits/withdrawals made today (default true): A deposit is not treated as profit, a withdrawal not as a loss; the % limit uses the start value plus today's deposits.
- Close all open positions when lock triggers (default true): false = positions opened before the lock are left to you; new ones are still closed and pending orders deleted.
- Magic filter (default 0): 0 = all positions and orders, all symbols (manual trades included). Other value = only that magic number. Measurement is always account-wide.
- Max slippage for closing, points (default 50): Deviation for closing orders (used on instant/request execution).
- Close/delete retries per attempt (default 5): Immediate retries on requote/busy. The EA also retries every second while locked.
- Show on-chart panel (default true): Panel via chart comment.
- Pop-up alert when the day locks (default true): One alert when the lock triggers.
- Tester: open demo trades (default true): Strategy Tester only. Ignored on live/demo accounts.
- Tester: close a demo trade after N minutes (default 240): Strategy Tester only.
FAQ
Does it block the Buy/Sell buttons?
No. No Expert Advisor can do that in MetaTrader 5. While the day is locked, the EA closes new positions and deletes new pending orders immediately after they appear.
Which time zone is used?
Broker server time (the time shown in Market Watch). Set the reset hour to match the reset time your rules use.
What happens if I restart the terminal after the lock?
The lock and the start-of-day values are stored in terminal global variables. After a restart on the same trading day, the EA reads them and the day stays locked.
What if I attach the EA in the middle of the day?
The start-of-day balance is rebuilt exactly from today's account history. Start-of-day equity cannot be rebuilt if positions were open at the reset; in that case the balance is used and the panel shows a note. Best practice: attach the EA before the reset and leave it running.
Can I raise the limit after the day locks?
Changing the inputs does not unlock the current day. The lock lifts at the next reset.
Does it work on several accounts?
Yes, one instance per terminal/account. The state is stored per account number. Attach it to one chart only; it watches all symbols.
Does it work with other EAs?
Yes. With magic filter 0 it also closes positions of other EAs while locked. With a magic number set, only that EA's positions and orders are affected.
Why does it trade in the Strategy Tester?
Only to demonstrate the lock (see "About the Strategy Tester"). It never opens trades on a real or demo account.
Is it a trading robot?
No. It never opens a trade on your account and makes no profit. It is a risk-control utility.
Where do I get support?
In the comments of this product page or via MQL5 private messages.
Many traders know their daily limit but break it after a bad trade. Many prop-firm style evaluations also measure the daily loss from the broker server's midnight and count floating (open) profit and loss, not only closed trades. This tool follows the same logic, so you can see in real time how much room you have left today.
How it works
1. At the daily reset (broker server time, midnight by default) the EA stores the start-of-day value: the start-of-day balance, or the higher of start-of-day balance and equity.
2. On every tick, every trade event and once per second it calculates today's loss: start value minus current equity (floating P/L included), or closed P/L only if you prefer.
3. When today's loss reaches your limit minus a small safety buffer, the day locks:
- all open positions are closed (all symbols, or only one magic number),
- all pending orders are deleted,
- the lock is saved in the terminal, so it stays active if you restart the EA or the terminal.
4. While the day is locked, any new position is closed immediately and any new pending order is deleted.
5. The lock lifts automatically at the next daily reset.
An on-chart panel shows the start value, today's loss, the limit, the room left, the status (OK / LOCKED) and the next reset time (server time).
Please read: what this tool cannot do
- It cannot physically block manual trading. MetaTrader 5 does not let an Expert Advisor disable the trade buttons. While locked, the EA closes new positions as soon as it sees them (normally within a fraction of a second, at most about 1 second). Each such trade can still cost you spread, commission and slippage.
- It only works while it is running. The terminal must be open and connected, the EA attached to a chart and Algo Trading enabled. If the PC, terminal or connection is down, nothing is enforced. A VPS is recommended. The panel shows a warning when Algo Trading is off.
- Closing is not guaranteed at your exact limit. Market orders can slip, and gaps (weekend, daily break, news), low liquidity or a closed market can make the final loss larger than the limit. The safety buffer helps, but it is not a guarantee. If the market is closed, the EA keeps retrying every second.
- It does not guarantee you pass any evaluation or follow any firm's rules. Each firm defines daily loss in its own way (reset time, base value, inclusion of commissions). Check your rules and set the inputs to match, ideally a bit stricter.
- It does not trade, gives no signals and makes no profit. It is a discipline and risk-control tool only.
- Removing the EA from the chart, or deleting its terminal global variables, removes the protection. It is designed against impulsive decisions, not against a determined user.
Features
- Daily loss limit in money and/or percent (when both are set, the stricter one is used)
- Base: start-of-day balance, or the higher of start-of-day balance / equity
- Daily reset hour in broker server time (0 = server midnight)
- Floating P/L included (prop-firm style) or closed P/L only
- Safety buffer: acts slightly before the limit to allow for slippage
- Closes all positions on all symbols, or only positions with one magic number
- Deletes pending orders
- Persistent lock for the rest of the day (survives EA and terminal restart, and changing the inputs)
- Instantly closes positions opened while locked
- Hedging and netting accounts
- Retries on requote / busy / price changed, automatic filling-mode fallback, splits volumes above the symbol maximum
- Deposits and withdrawals made today are not counted as profit or loss (option)
- No DLLs, no web requests, no hard-coded symbol
About the Strategy Tester
On a live or demo account this utility never opens a trade. In the Strategy Tester nobody places trades, so the EA opens small demo positions on the chart symbol (one at a time, about 5 % of free margin, held for 240 minutes by default) to show the daily lock at work. The backtest result therefore says nothing about profit — it only shows the lock. You can switch this off with the input "Tester: open demo trades"; these two inputs have no effect outside the tester.
Inputs
- Daily loss limit, money (default 0 (off)): Limit in account currency. 0 = not used.
- Daily loss limit, % of base (default 3.0): Limit as % of the base value. 0 = not used. If both are set, the stricter applies.
- Base for % limit and loss (default Start-of-day balance): Or "Higher of start-of-day balance / equity".
- Safety buffer, % of base (default 0.10): The lock triggers this much before the limit (slippage reserve).
- Day reset hour, SERVER time (default 0): 0 = broker server midnight. 0-23.
- Include floating P/L (default true): true = loss is measured on equity (open trades count). false = closed trades only.
- Ignore deposits/withdrawals made today (default true): A deposit is not treated as profit, a withdrawal not as a loss; the % limit uses the start value plus today's deposits.
- Close all open positions when lock triggers (default true): false = positions opened before the lock are left to you; new ones are still closed and pending orders deleted.
- Magic filter (default 0): 0 = all positions and orders, all symbols (manual trades included). Other value = only that magic number. Measurement is always account-wide.
- Max slippage for closing, points (default 50): Deviation for closing orders (used on instant/request execution).
- Close/delete retries per attempt (default 5): Immediate retries on requote/busy. The EA also retries every second while locked.
- Show on-chart panel (default true): Panel via chart comment.
- Pop-up alert when the day locks (default true): One alert when the lock triggers.
- Tester: open demo trades (default true): Strategy Tester only. Ignored on live/demo accounts.
- Tester: close a demo trade after N minutes (default 240): Strategy Tester only.
FAQ
Does it block the Buy/Sell buttons?
No. No Expert Advisor can do that in MetaTrader 5. While the day is locked, the EA closes new positions and deletes new pending orders immediately after they appear.
Which time zone is used?
Broker server time (the time shown in Market Watch). Set the reset hour to match the reset time your rules use.
What happens if I restart the terminal after the lock?
The lock and the start-of-day values are stored in terminal global variables. After a restart on the same trading day, the EA reads them and the day stays locked.
What if I attach the EA in the middle of the day?
The start-of-day balance is rebuilt exactly from today's account history. Start-of-day equity cannot be rebuilt if positions were open at the reset; in that case the balance is used and the panel shows a note. Best practice: attach the EA before the reset and leave it running.
Can I raise the limit after the day locks?
Changing the inputs does not unlock the current day. The lock lifts at the next reset.
Does it work on several accounts?
Yes, one instance per terminal/account. The state is stored per account number. Attach it to one chart only; it watches all symbols.
Does it work with other EAs?
Yes. With magic filter 0 it also closes positions of other EAs while locked. With a magic number set, only that EA's positions and orders are affected.
Why does it trade in the Strategy Tester?
Only to demonstrate the lock (see "About the Strategy Tester"). It never opens trades on a real or demo account.
Is it a trading robot?
No. It never opens a trade on your account and makes no profit. It is a risk-control utility.
Where do I get support?
In the comments of this product page or via MQL5 private messages.
