MetaTrader Expert Advisor Setup: A Complete Guide to Maximizing Profit
Learn how to configure an EA in MetaTrader 4/5, optimize its parameters, manage risk, and adapt its settings to different trading strategies.
MetaTrader Expert Advisor Setup: A Complete Guide to Maximizing Profit
Configuring an expert advisor correctly is key to profitable trading. Even the best EA can lose money with the wrong settings. This article covers the important parameters and explains how to optimize an EA for your trading strategy.
Core EA parameters
Most expert advisors have the following groups of settings:
1. Trading parameters
Lot Size
- The size of an individual trade
- A standard lot = 100,000 units of the base currency
- Minimum lot size (usually): 0.01
- Recommendation: Start with 0.01-0.1 on a demo account
Example:
Lot = 0.1 // Trade 0.1 lots
Stop Loss
- The maximum loss per trade in points
- Protects against large losses
- Recommendation: 20-50 points for scalping, 50-100 for day trading
Take Profit
- The profit-taking level in points
- Defines the target profit
- Recommendation: TP should be >= SL (a risk/reward ratio of at least 1:1)
Example:
StopLoss = 30 // SL of 30 points
TakeProfit = 60 // TP of 60 points (risk/reward = 1:2)
2. Money management
UseMoneyManagement
true: lot size is calculated automaticallyfalse: a fixed lot size is used
Risk (risk per trade)
- The percentage of your deposit you are willing to risk
- Recommendation: 1-2% for conservative trading, 3-5% for aggressive trading
Example:
UseMoneyManagement = true
Risk = 2.0 // Risk 2% of the deposit per trade
With a $1000 deposit and 2% risk, the maximum loss per trade = $20
3. Time filters
TradingStartHour / TradingEndHour
- The hours when trading begins and ends
- Useful for excluding periods of low liquidity
Example:
TradingStartHour = 8 // Start trading at 8:00
TradingEndHour = 18 // Stop trading at 18:00
TradeOnMonday, TradeOnFriday, etc.
- Enable/disable trading on particular weekdays
- Useful for avoiding Friday gaps
4. Spread filters
MaxSpread
- The maximum spread allowed for entry
- Prevents trading when costs are high
Example:
MaxSpread = 3 // Do not trade if spread > 3 points
Step-by-step EA configuration
Step 1: Open the EA settings
- Right-click the chart
- Select Expert Advisors → Properties
- Alternatively, double-click the EA name in the chart corner
Step 2: The Common tab
Make sure these options are checked:
- ☑️ Allow live trading
- ☑️ Allow DLL imports (if the EA requires it)
- ☑️ Allow import of external experts (optional)
Configure restrictions:
- Positions: allow both Long and Short, or only one direction
- Disable the EA when the account changes: for safety
Step 3: The Inputs tab
This contains all settings for the specific EA, arranged in groups for convenience.
Example configuration for a scalping EA:
=== Trading parameters ===
Lot = 0.1
StopLoss = 20
TakeProfit = 30
MaxSpread = 2
=== Money management ===
UseMoneyManagement = true
Risk = 2.0
=== Time filters ===
TradingStartHour = 9
TradingEndHour = 17
TradeOnFriday = false
=== Indicators ===
MAPeriod = 50
RSIPeriod = 14
UseRSI = true
Step 4: Check the settings
- Click OK to apply the settings
- Check the EA's status (the face should be smiling 😊)
- Open the Experts tab to view logs
Optimize settings with the Strategy Tester
Use the built-in Strategy Tester to find optimal parameters.
Starting optimization:
- Select View → Strategy Tester (Ctrl + R)
- Choose your EA from the list
- Specify the currency pair and testing period
- Go to the Optimization tab
- Select the parameters to optimize (Lot, SL, TP, etc.)
- Click Start
Important: Optimization can take several hours!
Analyzing results:
After optimization finishes, examine:
- Profit Factor: should be > 1.5
- Maximum Drawdown: lower is better
- Total Net Profit: overall profit
- Win Rate: the percentage of winning trades (ideally 50-70%)
Configuring risk management
Rule 1: Never risk more than 2% per trade
With a $1000 deposit:
- Maximum risk per trade = $20
- If SL = 30 points, lot size = 0.06
Lot size formula:
Lot = (Deposit * Risk%) / (StopLoss * PointValue)
Editor's note: The lot-size formula above is pseudocode: interpret Risk% as a fraction, and verify PointValue, lot units and stop-distance units for the specific instrument and account currency. The stated lot size is not a universal result for every symbol or broker.
Rule 2: Use a trailing stop
Many EAs support Trailing Stop, which automatically moves the SL behind price.
Example:
UseTrailingStop = true
TrailingStop = 20 // Start trailing at +20 points of profit
TrailingStep = 5 // SL adjustment step
Rule 3: Limit the maximum number of trades
MaxOpenOrders = 3 // No more than 3 simultaneous trades
MaxDailyTrades = 10 // No more than 10 trades per day
Settings for different strategies
Scalping (short-term trading)
Lot = 0.1
StopLoss = 10-20
TakeProfit = 15-30
MaxSpread = 2
TradingStartHour = 9
TradingEndHour = 17
Day trading (intraday trading)
Lot = 0.05
StopLoss = 40-80
TakeProfit = 60-120
MaxSpread = 5
CloseBeforeWeekend = true
Swing trading (medium-term trading)
Lot = 0.01-0.03
StopLoss = 100-200
TakeProfit = 200-400
UseTrailingStop = true
Common EA setup mistakes
❌ Mistake 1: Oversized lots
Problem: Risk of losing the entire deposit in a few trades
Solution: Use Money Management and risk no more than 2%
❌ Mistake 2: No Stop Loss
Problem: One bad trade can wipe out the account
Solution: Always set an SL, even if the EA does not require one
❌ Mistake 3: Ignoring spread
Problem: Frequent losing trades due to high costs
Solution: Set MaxSpread and trade on low-spread accounts
❌ Mistake 4: Trading outside suitable hours
Problem: High volatility and gaps at the market open
Solution: Use time filters and CloseBeforeWeekend
❌ Mistake 5: Copying someone else's settings
Problem: EA settings depend on the specific broker and account
Solution: Optimize parameters for your own trading conditions
Monitoring your EA
Check daily:
- Open positions: number and direction of trades
- Balance and Equity: changes in account value
- Expert logs: error messages
- Drawdown: should not exceed 20-30%
Use the log:
The Experts tab shows:
- Open trades
- Errors (such as “Not enough money”)
- EA messages (trading signals, calculations)
Backing up settings
Save a configuration:
- Open the EA settings
- Select the Inputs tab
- Click Save
- Enter a filename (such as “MyEA_Settings.set”)
Load settings:
- Select the Inputs tab
- Click Load
- Select a
.setfile
Settings files are stored in: MQL4/Presets/ or MQL5/Presets/
Recommended EAs for practice
Try configuring these vetted EAs:
Conclusion
Configuring an EA correctly means balancing profitability and risk. Follow these recommendations:
✅ Always test on demo before trading live
✅ Risk no more than 2% per trade
✅ Optimize parameters for your broker
✅ Keep a trading journal
✅ Monitor the EA regularly
Remember: there are no universal settings! Every broker, currency pair and trading style requires an individual approach.
Next steps:
🤖 Recommended trading robots
Put what you have learned into practice with our free EAs:
- Free MT4 expert advisors - a catalog of vetted trading robots
- All files have been tested and are ready to use
- Step-by-step installation and setup instructions are included
Popular EAs:
- Quantum Emperor MT4 - an advanced robot with adaptive stop losses
- AI Gen XII EA - an intelligent EA using neural networks
- Black Diamond EA - a reliable robot for beginners
Share this article:
Comments (0)
No comments yet
Be the first to leave a comment!