Session Exit Guard
- 实用工具
- 版本: 1.0
- 激活: 5
Time guard for MT5: closes positions at a daily exit time and before the weekend, and keeps you out of trades during no-trade windows such as news times.
Session Exit Guard is a trading utility for MetaTrader 5 - time-based exits and no-trade windows. Flat before the close, out of the market during the news - every day. It works on any symbol (designed with XAUUSD / gold in mind) and on hedging and netting accounts.
What it does
- Daily exit - closes the positions in scope at a set server time (for example before the rollover / swap time).
- Weekend exit - closes everything before the Friday close, so no position is held over the weekend gap.
- No-trade windows - list times such as 15:30,17:00; positions opened inside a window (+/- N minutes) are closed straight away, and optionally all positions are closed when a window starts.
- Panel - server time, countdown to the next exit, window status and spread; CLOSE ALL and SKIP TODAY buttons.
Safety (built in)
- The tool never uses martingale, grid or averaging down. Orders it opens always carry a stop-loss.
- Lot size from risk % of equity (or a fixed lot), normalised to the broker's min / max / step and reduced if free margin is not enough.
- Stop-loss and take-profit changes respect the broker's stops and freeze levels; no orders or closes are sent while the market is closed.
- Every action is printed to the Experts log so you can see what the tool did and why.
Strategy Tester demo
MetaTrader 5 does not send button clicks in the Strategy Tester, so the free demo runs an automatic demonstration: it opens sample trades every few bars and the tool manages them exactly as it would live. Run it in visual mode to watch the panel. Switch the demo off with the "Strategy Tester: run the automatic demo" input. The demo never runs on a live or demo account.
Inputs
| Input | Default |
|---|---|
| Positions the guard closes | All positions on this chart's symbol |
| Close positions every day at the exit time | true |
| Daily exit hour (0-23) | 22 |
| Daily exit minute (0-59) | 45 |
| Close positions before the weekend | true |
| Friday exit hour (0-23) | 21 |
| Friday exit minute (0-59) | 30 |
| No-trade times, e.g. 15:30,17:00 (empty = none) | (empty) |
| Minutes before and after each no-trade time | 15 |
| Also close open positions when a no-trade window starts | false |
| Spread warning above this (points, gold: 100 = 1.00 USD; 0 = off) | 0 |
| Default risk per order (% of equity), used when Fixed lot = 0 | 1.0 |
| Fixed lot (0 = size from risk %) | 0.0 |
| Maximum lot per order (0 = broker maximum) | 10.0 |
| Max slippage (points, 2-digit gold scale: 100 = 1.00 USD) | 30 |
| Magic number of orders opened by this tool | 26102308 |
| Panel X position (pixels) | 20 |
| Panel Y position (pixels) | 30 |
| Strategy Tester: run the automatic demo (opens sample trades) | true |
| Strategy Tester demo: bars between sample trades | 24 |
How to use
- Attach the tool to a chart (allow Algo Trading).
- Set your limits in the inputs; the panel appears in the top-left corner (position adjustable).
- Use the panel buttons; the guard rules run automatically every second, even without ticks.
Important notes
- A utility helps you manage risk - it cannot guarantee profit or prevent every loss (gaps and slippage can move price past any level).
- Test on a demo account first. Times are your broker's server time.
- Keep the terminal running (a VPS is recommended) for the automatic rules to work.
