Skip to main content

Running Optimizations

Optimization lets MT4 test different input combinations for the EA. It is a research tool, not a shortcut to a guaranteed setup.

Use optimization to compare settings, understand how sensitive a setup is, and decide what should be tested next.

warning

An optimized result can be overfitted to historical data. Always validate selected settings on data that was not used during optimization.


Before You Start

Confirm these items first:

  • BananaEA is installed in the correct MT4 terminal.
  • Historical data is available for the symbol and timeframe.
  • Spread and commission assumptions are realistic for your broker.
  • You know which inputs you want to test.
  • You have chosen a separate period for later validation.

Do not optimize every input at once. Start with the settings that have the clearest trading purpose.


Open The Strategy Tester

  1. Open MT4.
  2. Press Ctrl+R to open Strategy Tester.
  3. Select BananaEA in the Expert Advisor field.
  4. Choose the symbol and timeframe.
  5. Choose the test model and date range.
  6. Enable Optimization.

The exact Strategy Tester layout depends on your MT4 build and broker.


Choose The Data Period

Separate the work into two parts:

  • Optimization period: used to search for candidate settings.
  • Validation period: reserved for a later out-of-sample test.

Do not optimize and validate on the same period. If you keep changing settings after viewing validation results, the validation period is no longer independent.


Select Inputs To Optimize

In the Inputs tab, enable optimization only for the parameters you want MT4 to vary.

Each optimized input usually has:

  • Start: first value to test
  • Step: amount added each pass
  • Stop: final value to test

Use practical ranges. Very wide ranges can produce many combinations and make the result table harder to interpret.

Common Input Groups

Depending on your EA version, you may test:

  • risk or lot sizing inputs
  • stop loss and take profit inputs
  • trailing stop inputs
  • trading hours
  • signal filters
  • spread limits
  • pending order settings

Only test inputs you understand. If an input is unclear, leave it at the default value until you have reviewed the settings guide.


Choose An Optimization Method

MT4 may offer different optimization modes depending on the build:

  • Complete optimization: tests every selected combination. This is slower but more exhaustive.
  • Genetic optimization: searches a smaller subset. This can be faster, but it may skip some combinations.

For early learning, use small ranges and complete optimization where practical. For larger tests, genetic optimization may be useful, but selected results still need validation.


Choose The Sorting Criterion

MT4 lets you sort optimization results by different statistics. No single statistic is enough.

Useful review fields include:

  • net result
  • drawdown
  • profit factor
  • expected payoff
  • number of trades
  • consecutive losses
  • balance and equity curve shape

Avoid selecting a setup only because it is the top row in the results table.


Run The Optimization

  1. Confirm the symbol, timeframe, model, and date range.
  2. Confirm that Optimization is enabled.
  3. Confirm the input ranges.
  4. Click Start.
  5. Wait for MT4 to finish the test passes.

Optimization can take time. Avoid using the terminal for other heavy tasks while the run is active.


Review The Results Table

After the run finishes, review the group of stronger candidates rather than only the highest result.

Look for:

  • several nearby settings with similar behavior
  • reasonable trade count
  • drawdown that fits your risk tolerance
  • no dependence on one extreme result
  • stable behavior across small input changes

Be cautious when:

  • one setting is much better than every nearby setting
  • the test has very few trades
  • small input changes produce very different results
  • the result depends on a short market period
  • costs or spread assumptions are unrealistic

Save Candidate Settings

When you find a candidate:

  1. Open the pass details or load the input values.
  2. Save the settings as a .set file.
  3. Use a clear file name that includes symbol, timeframe, EA version, and date.
  4. Record the test period and broker conditions in your notes.

Example file name:

BananaEA_451_GER40_M5_candidate_2026-04-29.set

Validate The Candidate

The next step is not live trading. The next step is validation.

Run the saved .set file on:

  • the reserved out-of-sample period
  • a demo account using live market data
  • a small live test only if you understand and accept the risk

If validation fails or behaves unexpectedly, either reject the setup or restart the optimization process with clearer assumptions.