SafeZone Auto Close by Sadam Majid
- ユーティリティ
- Muchamad Sadam Madjid
- バージョン: 1.1
- アクティベーション: 5
SafeZone Auto Close – Smart Equity Protection Script (MT5)
Automatically protects your trading account by closing all positions once your equity reaches a defined profit target or critical loss limit – with optional time filter for trading hours.
🔧 What This Script Does
SafeZone Auto Close is a lightweight yet powerful MetaTrader 5 (MT5) script designed to monitor your equity in real time and instantly close all open positions based on two conditions:
-
✅ Profit Target Reached – Close all positions when your equity is greater than or equal to a user-defined EquityTarget.
-
❌ Loss Limit Reached – Close all positions when your equity drops to or below a user-defined EquityMinimum.
-
⏱️ (Optional) Time Filter – Only activate the script within specific hours you define (e.g., between 08:00 to 22:00).
📌 Key Features
-
Account-wide Equity Monitoring
-
Works on any symbol, any chart.
-
Automatically pulls total equity from the account.
-
-
Dual Trigger System
-
Profit trigger ( EquityTarget )
-
Loss trigger ( EquityMinimum )
-
-
Smart Time Filter (Optional)
-
Prevents the script from acting outside of your designated trading hours.
-
Useful to avoid closure during night sessions or low volatility hours.
-
-
Error Handling & Logging
-
All actions and errors are recorded to SafeZone_Log.txt (Common folder).
-
Includes human-readable timestamps for all logs.
-
-
Clear Notifications in Terminal
-
Displays all decisions via Print() with symbols: ✅ ❌ ℹ️ ⏱️
-
Debug-friendly for live and backtesting environments.
-
📥 Inputs
| Parameter | Description |
|---|---|
| EquityTarget | Close all positions when equity is greater than or equal to this value. (e.g. 1000) |
| EquityMinimum | Close all positions when equity is less than or equal to this value. (e.g. 800) |
| UseTimeFilter | Enable or disable the time filter. (true/false) |
| StartHour | Script starts monitoring from this hour. (0–23) |
| EndHour | Script stops monitoring after this hour. (0–23) |
🧠 Use Case Examples
-
✅ Trailing equity protection after reaching daily goal.
-
❌ Emergency equity stop to prevent account blowout.
-
💼 Prop Firm Challenge support, e.g. FTMO / MFF – exit when drawdown rules are near violation.
-
🔄 Combine with EAs or manual trading for automated safety net.
🛠️ How to Use
-
Attach the script to any chart in MetaTrader 5.
-
Set your EquityTarget and EquityMinimum .
-
(Optional) Activate UseTimeFilter and define active hours.
-
Click OK – the script will execute its logic instantly.
⚠️ Note: This is a script, not an EA. It executes once per run – reattach or automate if needed repeatedly.
🧾 File & Installation
-
File: SafeZone Auto Close.mq5
-
Platform: MetaTrader 5
-
Type: Script
-
Location: Copy to MQL5/Scripts folder
-
Log File: Common Files\SafeZone_Log.txt
👨💻 Author Info
Sadam Majid
Telegram: @trabarcryptoforex
© 2025 All Rights Reserved
