A collection of custom Expert Advisors (EAs) and tools for MetaTrader 5, designed to enhance your trading experience.
Automatically manages stop losses for your manually opened trades with these features:
- Sets initial stop loss automatically when you open a position
- Dynamic trailing stop that adapts to market volatility using ATR
- Option to use fixed pip-based stops
- Minimum distance protection to avoid getting stopped out too quickly
- Download this repository by clicking the green "Code" button and selecting "Download ZIP"
- Extract the ZIP file to a temporary location
- Open MetaTrader 5
- Click File → Open Data Folder
- Navigate to MQL5 → Experts
- Copy the "Abhis_EAs" folder from the downloaded files to this location
- Restart MetaTrader 5
-
In MetaTrader 5, open the Navigator panel (Ctrl+N)
-
Find "Abhis_EAs" under "Expert Advisors"
-
Double-click "Auto_SL" to add it to your chart
-
Configure the settings:
- FixedSLPips: Initial stop loss distance (default: 20 pips)
- UseATR: Set to true for dynamic stops based on volatility
- ATRPeriod: Look-back period for ATR (default: 14)
- ATRMultiplier: How wide to set the stop loss (default: 1.5)
- EnableTrailing: Turn trailing stop on/off
- MinimumPips: Minimum distance for trailing stop
-
Click "OK" to start the EA
-
Look for a smiley face in the top right corner of your chart
-
Now open trades normally - the EA will manage your stop losses automatically
- Install Visual Studio Code
- Install these VS Code extensions:
- MQL Tools
- Run on Save (emeraldwalk.RunOnSave)
- Install MetaTrader 5 terminal(s)
- Install Git (for version control)
-
Clone this repository:
git clone https://github.com/yourusername/metatrader5-utilities.git cd metatrader5-utilities -
Update VS Code configuration:
- Open
.vscode/c_cpp_properties.json - Update the terminal IDs in
includePathfor your MT5 installations - Update the
compilerPathto your MetaEditor location
- Open
-
Update compile.bat:
- Open
compile.bat - Update paths for your MT5 terminal(s)
- Paths should match your MetaEditor installations
- Open
- Open the project in VS Code
- Modify any .mq5 file
- Changes auto-compile on save
- Updates appear instantly in MT5
metatrader5-utilities/
├── .vscode/ # VS Code configuration
├── Experts/
│ └── Abhis_EAs/ # Expert Advisors
├── Include/
│ └── Abhis_Include/ # Custom include files
├── Indicators/
│ └── Abhis_Indicators/ # Custom indicators
├── Scripts/
│ └── Abhis_Scripts/ # Utility scripts
├── compile.bat # Multi-terminal compiler
└── README.md
- Open MT5
- Click File → Open Data Folder
- Look at the address bar
- The long alphanumeric string is your terminal ID
Example:
C:\Users\...\Terminal\49CDDEAA95A409ED22BD2287BB67CB9C\
-
Compilation not working?
- Check terminal IDs in c_cpp_properties.json
- Verify MetaEditor paths in compile.bat
- Ensure VS Code extensions are installed
-
Changes not appearing in MT5?
- Check if compilation shows any errors
- Try restarting MT5
- Verify symbolic links are correct
-
IntelliSense not working?
- Check paths in c_cpp_properties.json
- Reload VS Code window
- Reinstall MQL Tools extension
-
FixedSLPips (default: 20.0)
- Fixed stop loss distance in pips
- Used when UseATR is false
- Example: 20 pips = $20 on a standard lot EURUSD
-
UseATR (default: true)
- Enables dynamic stop loss based on market volatility
- True: Uses ATR for dynamic stops
- False: Uses fixed pips distance
-
ATRPeriod (default: 14)
- Lookback period for ATR calculation
- Higher = smoother, slower adaptation
- Lower = faster adaptation to volatility
-
ATRMultiplier (default: 1.5)
- Multiplier for initial stop loss distance
- Higher = wider stops
- Lower = tighter stops
-
TrailATRMultiplier (default: 1.0)
- Multiplier for trailing stop distance
- Usually lower than ATRMultiplier
- Controls how closely price is followed
-
MinimumPips (default: 5)
- Minimum trailing distance in pips
- Prevents too-tight stops
- Safety mechanism against whipsaws
- Always test on a demo account first
- Start with default settings and adjust gradually
- Keep the watch script running while developing
- Backup your modifications regularly
Feel free to:
- Fork the repository
- Create a new branch
- Submit pull requests with improvements
This project is licensed under MIT - feel free to use and modify for your personal trading.
If you encounter any issues:
- Check the build_log.txt file for compilation errors
- Verify the EA shows a smiley face on the chart
- Check the "Experts" tab in MT5 for error messages
- Create an issue in this repository
Good luck with your trading! 🚀