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.
To prevent your system from crashing during backtesting and optimization in MT4 or MT5, two precautionary methods are available

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.

  • 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 press Ctrl + Shift + Esc or Ctrl + Alt + End for Windows Server and then choose Task Manager.

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

  • 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.

  • 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.

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

  • 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.

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.

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

  • Configure Testing Parameters: Set up your desired parameters for the backtest, such as the date range and model.

  • 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

  • Start Optimization: Click Start to begin the optimization with the adjusted number of cores or agents.

Was this article helpful?
[mepr-membership-registration-form id="13707"]
[mepr-membership-registration-form id="13708"]
[mepr-membership-registration-form id="13633"]
[mepr-membership-registration-form id="13635"]
[mepr-membership-registration-form id="13634"]