Most people talk about EA coding or trading strategies. Nobody talks about the boredom of waiting for a backtest to finish. I spent last Thursday afternoon staring at a progress bar that refused to move past 87%. The strategy wasn't even complicated – a simple moving average crossover with a trailing stop. But somehow, five years of tick data on EURUSD was taking forever.
I started digging. What I found wasn't in any single official guide. It was a combination of small things that, together, cut my backtesting time by about half. And the best part? Most of these fixes take less than a minute to implement.
The Arrow Problem Nobody Mentions
Here's something I discovered purely by accident. Run a visual backtest and watch the chart. Every time your EA opens or closes a trade, MT4/MT5 draws an arrow on the chart. Entry arrows, exit arrows, stop loss markers, take profit markers. After a few hundred trades, your chart looks like a porcupine.
Now, the official MQL4 documentation tells you how to use
ObjectCreate() and ObjectDelete() for custom chart objects. But it doesn't tell you that the backtest engine is generating its own objects in the background, and those objects consume CPU resources. The more trades your EA makes, the more objects pile up, and the slower your backtest runs.I found a discussion where someone mentioned deleting chart arrows during a live backtest to speed things up. At first I thought it was nonsense. How can deleting visual elements affect calculation speed? But I tested it. Open a running visual backtest, click the "Delete" button on the toolbar (the one that removes trend lines and objects), and click "Delete All Objects" from the dropdown. The chart clears instantly. And the backtest speed? It jumped noticeably within seconds.
The official MetaQuotes help center discusses performance optimization but focuses on things like reducing max bars in charts and disabling news feeds. They never mention object accumulation. That's a blind spot in their documentation, and it costs traders hours of waiting.
The Log File That Eats Your CPU
Another hidden performance killer: the terminal log. By default, MT4 and MT5 log every single event during backtesting. Every tick processed, every price check, every order modification. If you're running a high-frequency strategy, that log file grows fast.
Exness' help center actually mentions this: if you're running Expert Advisors, consider disabling logging because it consumes computer memory. That's buried in their FAQ, not in MetaQuotes' own documentation. But it's a legitimate fix.
Go to
Tools > Options > Expert Advisors and uncheck "Enable logging of Expert Advisors" during backtesting. That alone shaved off about 15% of runtime in my tests. The logs are useful for debugging, but when you're doing a serious optimization run, you don't need them.Reducing Max Bars – But Don't Overdo It
The standard advice is to reduce "Max bars in chart" and "Max bars in history" under
Tools > Options > Charts. The recommended approach is to cut these values by 50%. I took it further. I set "Max bars in history" to the exact number of bars my strategy actually needs.Here's the trick: if your EA uses a 200-period moving average, you don't need 100,000 bars of historical data for the calculation. The first 199 bars are just filling up the moving average buffer. Everything before that is irrelevant. Set "Max bars in history" to 2000 or 3000, not the default 50000. That forces the terminal to load less data into memory.
But there's a catch I haven't seen documented anywhere: if you set this value too low, your indicator calculations might start from a point where the moving average hasn't fully "warmed up". The official MQL4 docs explain that indicators need enough bars to calculate properly. So find the sweet spot. For a 200-period SMA with a 50-bar signal filter, 3000 bars is plenty. For a strategy using daily data, you might need more.
The Offline Charts Workaround
Here's a weird one. During backtesting, if you keep the chart window open and scroll around, the terminal is constantly redrawing. That uses CPU. The fix is simple: after you start the backtest, minimize the chart window. Don't close it – minimizing stops the real-time rendering while the calculation continues.
I tested this side by side. Same EA, same data range. One test with the chart maximized, one with the chart minimized. The minimized version finished about 12% faster. It's not huge, but it adds up over hundreds of optimization runs.
VPS vs Local Machine – The Real Difference
Everyone recommends using a VPS for live trading. For backtesting, it's a different story. The Exness help center mentions VPS primarily for execution speed and connection stability. But for backtesting, your local machine is almost always faster, provided you have a decent CPU.
The reason? Backtesting uses historical data stored locally. There's no network latency. All the computation happens on your processor. A VPS typically has shared CPU resources and might actually be slower for heavy number-crunching. I run my live EAs on a VPS, but I do all my backtesting on my desktop. The difference is noticeable.
The Optimization Run Order Trick
This is my own observation from years of running parameter optimizations. The built-in optimizer runs through parameters in the order you specify. If you have three parameters, it runs the innermost loop first. That means it will fully optimize the last parameter before moving to the next one.
If one of your parameters is computationally expensive (like a complex indicator calculation), put it in the outer loop. The optimizer will calculate it fewer times. MQL4 doesn't have explicit loop ordering controls for the optimizer, but you can structure your input parameters to minimize redundant calculations. Put the most expensive parameter as the first input, and the cheapest as the last.
I haven't found this documented anywhere official. It's just something I figured out by watching CPU usage during optimizations. A 30-second optimization can become a 20-second one with this simple reordering.
The Cumulative Effect
Using all these fixes together? My backtesting time dropped from about 45 minutes to roughly 20 minutes on a 5-year tick data test. That's a 55% improvement without changing a single line of EA code. No strategy modification, no hardware upgrade. Just better understanding of how the terminal actually works.
The MetaTrader platform is powerful, but its performance bottlenecks are rarely discussed in official channels. MetaQuotes documents what you can do, not what you shouldn't do. That's where experience fills the gap.
References: MetaQuotes Help Center – Enhancing MetaTrader Performance (help.metaquotes.net), MQL4 Documentation – Custom Indicators (docs.mql4.com), Exness Help Center – Can I improve MetaTrader performance? (get.exness.help).
This article is originally published on FXEAR.com, original content, reproduction without authorization is prohibited.