30% off first MonthAll Promos
MT4/MT5

How to avoid server stall or crash during MT4/MT5 backtesting and optimization

Backtesting and optimization in MetaTrader 4 (MT4) or MetaTrader 5 (MT5) can cause your computer to crash or become unresponsive due to the high computational load involved, especially if your system lacks sufficient RAM or CPU power. The process demands substantial resources, which can overwhelm your hardware, particularly if you are running complex strategies or large datasets.

Tip

To prevent your system from crashing during backtesting and optimization in MT4 or MT5, two precautionary methods are available

Alert

Lower MT4/MT5 Terminal Process Priority:

Adjust the priority of the MetaTrader terminal process to “Below Normal” in your system’s Task Manager. This prevents the trading platform from using too much CPU resource and helps ensure that other critical system processes have enough resources to run smoothly.

  • Start MetaTrader:
    Launch your MetaTrader 4 or MetaTrader 5 terminal and ensure it’s running.
    MetaTrader terminal running

  • Open Task Manager:
    For Windows 10/11: Right-click on the Taskbar at the bottom of your screen and select Task Manager. Alternatively, you can pressCtrl + Shift + Esc or Ctrl + Alt + End for Windows Server and then choose Task Manager.
    Opening Task Manager from the Windows taskbar

    MetaTrader process in the Task Manager Processes tab

  • Locate MetaTrader Process:
    In Task Manager, go to the Processes tab.
    Look for the MetaTrader process. It may be listed asterminal.exe for MT4 orterminal64.exe for MT5. If you have multiple instances, you might see several entries.
    terminal64.exe process entries in Task Manager

  • Right-Click on MetaTrader Process:Right-click on the MetaTrader process entry.
  • Select “Go to Details”:
    From the context menu, choose Go to details. This will take you to the Details tab and highlight the MetaTrader process.
    Go to details option in the Task Manager context menu

  • Change Process Priority:Right-click on the highlighted MetaTrader process in the Details tab.
    Hover over Set priority in the context menu.
    Select Below normal from the submenu.
    Set priority submenu with Below normal selected in Task Manager

  • Confirm the Change:
    A confirmation dialog may appear asking if you want to change the priority. Click Change priority to confirm.
    Change priority confirmation dialog in Task Manager

  • Close Task Manager:
    Once the priority has been adjusted, you can close Task Manager.

    You can always change the process priority back to normal by doing the same step and selecting Normal or you can restart your server.

    Success

Disable Cores/Agents:

  • Disable Cores/Agents:
    Reduce the number of cores or agents used for optimization in MT4/MT5. By disabling at least one core or agent, you decrease the strain on your CPU, which can help prevent overheating and system instability during intensive backtesting sessions.
  • Open MetaTrader Terminal:
    Launch your MetaTrader 4 or MetaTrader 5 terminal.
  • Open Strategy Tester:
    Click on the View menu at the top and select Strategy Tester or press Ctrl + R to open the Strategy Tester and select the Settings tab.
    Strategy Tester settings tab in MetaTrader

  • Select Expert Advisor:
    Choose the Expert Advisor (EA) you want to test from the drop-down list in the Strategy Tester window.
    Expert Advisor selection in the MetaTrader Strategy Tester

  • Configure Testing Parameters:
    Set up your desired parameters for the backtest, such as the date range and model.
    Expert Advisor selection in the MetaTrader Strategy Tester

  • Access Agents Settings:
    Click on the Agents tab within the Strategy Tester window.
  • Adjust Core or Agent Usage:
    Right-click on one of the listed Agents and select Disable
    Agents tab in the Strategy Tester with an agent disabled

  • Start Optimization:
    Click Start to begin the optimization with the adjusted number of cores or agents.
    Start button beginning the optimization in the Strategy Tester

Was this article helpful?

Not finding what you are looking for?

Get in touch with our highly experienced team of humans!

Checking on a live issue? See current system status.

Avg response < 2 min
CALLAvg response < 2 min
EMAILDetailed reply within 24h