-
Are there any specific settings, tools, or optimizations that can significantly reduce testing time?
I backtest LOOPING ALL timeframes(17) and ALL FX major and minor(28) pairs for 17 years in 30 minutes with visual mode on , and OHLC.
Use the bellow code on your OnTick so you can avoid tester reading the code on every tick, or even minute, or even 5 minutes.
LOOPING on 10 minutes timeframe will give you 30 minutes result
void OnTick()
{
string thissymbol="USDCAD";
ENUM_TIMEFRAMES timeframe=PERIOD_M10;
if(
(iClose(thissymbol,timeframe,0) == iOpen(thissymbol,timeframe,0))
&& (iClose(thissymbol,timeframe,0) == iHigh(thissymbol,timeframe,0))
&& (iClose(thissymbol,timeframe,0) == iLow(thissymbol,timeframe,0))
&& (iHigh(thissymbol,timeframe,0) == iLow(thissymbol,timeframe,0))
&& (iOpen(thissymbol,timeframe,0) == iLow(thissymbol,timeframe,0))
&& (iOpen(thissymbol,timeframe,0) == iHigh(thissymbol,timeframe,0))
)
{ ...rest of code here... }
} Hi everyone,
I’ve been working on backtesting my Expert Advisor using MetaTrader 5, but I’m facing a serious performance issue.
When I try to run a backtest for just 1 year of data, it takes around 4–5 hours to complete, which feels unusually slow. I’m not sure if this is expected or if something is wrong with my setup or EA.
My EA falls under the HFT (High-Frequency Trading) category, so I understand that it may require more precise data and processing. However, I’d like to know how you guys handle backtesting for similar strategies.
-
How do you approach backtesting your EA efficiently?
-
How long does a typical 1-year backtest take in your case?
-
Are there any specific settings, tools, or optimizations that can significantly reduce testing time?
I’m here to learn and would really appreciate your guidance or suggestions to improve this process.
Thanks in advance for your help!
There is no point in asking how long other EA's take to back test considering it all depends on the complixity and code optimizations.
- Use the virtual library https://www.mql5.com/ru/code/22577
- Use Math Mode https://www.mql5.com/ru/code/61283
- Optmimize code. Do not calcculate on every tick things you do not use. Do not compare strings (panifully slow), avoid divisions if possible for exmaple Bid+Ask/2 is slower compared to Bid+Ask*0.5. These little things can add up quickly.
Hi everyone,
I’ve been working on backtesting my Expert Advisor using MetaTrader 5, but I’m facing a serious performance issue.
When I try to run a backtest for just 1 year of data, it takes around 4–5 hours to complete, which feels unusually slow. I’m not sure if this is expected or if something is wrong with my setup or EA.
My EA falls under the HFT (High-Frequency Trading) category, so I understand that it may require more precise data and processing. However, I’d like to know how you guys handle backtesting for similar strategies.
-
How do you approach backtesting your EA efficiently?
-
How long does a typical 1-year backtest take in your case?
-
Are there any specific settings, tools, or optimizations that can significantly reduce testing time?
I’m here to learn and would really appreciate your guidance or suggestions to improve this process.
Thanks in advance for your help!
I have to question whether your EA is really HFT given the professional-grade infrastructure and connection speed required. In any event, suffice it to say that your EA somewhat frequently trades on tick data. In my experience, backtesting on tick data is inherently burdensome on MT5 and hardware, and 4 to 5 hours is normal without using custom utilities.
I have to question whether your EA is really HFT given the professional-grade infrastructure and connection speed required. In any event, suffice it to say that your EA somewhat frequently trades on tick data. In my experience, backtesting on tick data is inherently burdensome on MT5 and hardware, and 4 to 5 hours is normal.
Define HFT. Is 20k trades in 4 months time window considered HFT? Then it is perfectly doable with plain old MT5.
4/5 hours is normal - there is no such thing as normal. It al depends and without context it is meaningless.
-
(iClose(thissymbol,timeframe,0) == iOpen(thissymbol,timeframe,0)) && (iClose(thissymbol,timeframe,0) == iHigh(thissymbol,timeframe,0)) && (iClose(thissymbol,timeframe,0) == iLow(thissymbol,timeframe,0)) && (iHigh(thissymbol,timeframe,0) == iLow(thissymbol,timeframe,0)) && (iOpen(thissymbol,timeframe,0) == iLow(thissymbol,timeframe,0)) && (iOpen(thissymbol,timeframe,0) == iHigh(thissymbol,timeframe,0))
This can only be true on the first tick of a new bar. Check for that instead.
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart), volume is unreliable (miss ticks), Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
MT4: New candle - MQL4 programming forum #3 (2014)
MT5: Accessing variables - MQL4 programming forum #3 (2022) - HFT is not multiple times a day; it is millions of transactions per day.
You can't do that over the internet. You can't do that with MetaTrader. Spend a few million for a colocated server with your broker to start.
MT4: Bother with HFT system - Trading Systems - MQL5 programming forum $5 #8 (2025)
HFT is not multiple times a day; it is millions of transactions per day.
You can't do that over the internet. You can't do that with MetaTrader. Spend a few million for a colocated server with your broker to start
Thank you for confirming that as a veteran of trading and coding─who I recognize going back to the heyday of mql4.com.
A large part of the widespread confusion about the definition of HFT is likely due to many FX broker-dealers having erroneously deemed any form of rapid scalping as "HFT." I suppose that it's easier to label rapid scalping as HFT, which already has negative connotations, than it is to appropriately define rapid scalping─especially for the broker-dealer's purpose of prohibiting rapid scalping.
Sellers alleging to sell MetaTrader "HFT" products also get a dishonorable mention.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use

Hi everyone,
I’ve been working on backtesting my Expert Advisor using MetaTrader 5, but I’m facing a serious performance issue.
When I try to run a backtest for just 1 year of data, it takes around 4–5 hours to complete, which feels unusually slow. I’m not sure if this is expected or if something is wrong with my setup or EA.
My EA falls under the HFT (High-Frequency Trading) category, so I understand that it may require more precise data and processing. However, I’d like to know how you guys handle backtesting for similar strategies.
How do you approach backtesting your EA efficiently?
How long does a typical 1-year backtest take in your case?
Are there any specific settings, tools, or optimizations that can significantly reduce testing time?
I’m here to learn and would really appreciate your guidance or suggestions to improve this process.
Thanks in advance for your help!