Skip to content

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.

Admin
Article cover: MetaTrader Expert Advisor Setup: A Complete Guide to Maximizing Profit

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 automatically
  • false: 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

  1. Right-click the chart
  2. Select Expert Advisors → Properties
  3. 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

  1. Click OK to apply the settings
  2. Check the EA's status (the face should be smiling 😊)
  3. 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:

  1. Select View → Strategy Tester (Ctrl + R)
  2. Choose your EA from the list
  3. Specify the currency pair and testing period
  4. Go to the Optimization tab
  5. Select the parameters to optimize (Lot, SL, TP, etc.)
  6. 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%)

Learn more about EA testing

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:

  1. Open positions: number and direction of trades
  2. Balance and Equity: changes in account value
  3. Expert logs: error messages
  4. 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:

  1. Open the EA settings
  2. Select the Inputs tab
  3. Click Save
  4. Enter a filename (such as “MyEA_Settings.set”)

Load settings:

  1. Select the Inputs tab
  2. Click Load
  3. Select a .set file

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:

Share this article:

Comments (0)

Sign in to leave a comment

No comments yet

Be the first to leave a comment!

More EA guides and tests

EA reviews, demo trading results and MQL5 notes.

All blog articles