Detect Hardcoded Dates in Forex Expert Advisors


Subscribe to our channel, here you will find the best 👇

A beautiful backtest is not proof that a Forex Expert Advisor is reliable.

A smooth equity curve, a high profit factor, low drawdown, and stable historical growth may look convincing. But in algorithmic trading, a backtest that looks too perfect should not be accepted at face value. It should be stress-tested.

The reason is simple: an Expert Advisor may not be a robust trading system. It may be over-optimized for a specific historical period. In the worst case, the EA may contain hardcoded dates, hidden filters, or specific time-based rules designed to avoid known losing periods in historical data.

For traders, this is a serious risk. In the Strategy Tester, such an EA may look excellent. In real trading, however, the robot no longer knows which future dates should be avoided. As a result, the strategy may quickly lose the edge shown in the backtest.

One practical way to identify this risk is to run a time-shifted quote test. Tick Data Suite provides a convenient 28-year tick data shift function, but the same concept can also be tested manually by exporting historical quotes, shifting the timestamps with a custom script, and importing the modified data into MT4 or MT5. The purpose is to determine whether the EA’s performance depends too heavily on the original calendar structure of the historical data.


The Problem With a Standard Backtest

A standard backtest shows how an Expert Advisor would have performed on a specific historical period under specific testing conditions.

But it does not answer more important questions:

  • Was the strategy fitted to that exact historical period?
  • Does the EA use hidden calendar filters?
  • Does it avoid known historical losing days?
  • Will the logic remain stable on unseen data?
  • Is the result dependent on one broker, one spread model, or one historical configuration?
  • Does the EA behave the same way in the Strategy Tester and in live trading?

Even a high-quality tick data backtest with variable spread and accurate modelling does not prove that the trading logic is clean. Good data improves price simulation. It does not verify the internal logic of the Expert Advisor.

If the EA contains conditions such as “do not trade in March 2020” or “skip these specific dates,” the backtest may look much better than the real trading system actually is.


What Are Hardcoded Dates in an Expert Advisor?

Hardcoded dates are conditions inside the EA code that change the robot’s behavior based on a specific day, month, or year.

A simple example:

</> MQL4
if (Year() == 2020 && Month() == 3)
{
   return;
}

This code disables trading in March 2020. If that month was a losing period for the strategy, the filter can artificially improve the backtest.

A more specific example:

</> MQL4
if (Year() == 2015 && Month() == 1 && Day() == 15)
{
   return;
}

In this case, the EA skips one exact day. If the strategy would have taken a large loss on that day, the equity curve becomes cleaner.

The issue is not that every date filter is bad. Some calendar-based restrictions are legitimate: news filters, Friday close rules, rollover protection, low-liquidity periods, or holiday filters.

The problem begins when these filters are not disclosed to the user and appear to be used to remove known losing periods from the historical test.


How the 28-Year Shift Test Works

The concept is straightforward: the same market movement is tested again, but the calendar dates are shifted 28 years into the past.

In other words, the price sequence remains comparable, but the dates change.

If an Expert Advisor makes decisions based on price action, indicators, volatility, trading sessions, and normal market logic, its behavior should remain broadly similar. The result does not need to be identical, but the general trade structure and risk profile should not collapse.

If the EA relies on exact dates or hidden historical filters, those conditions may no longer match the same market movements after the shift. In that case, the result can change dramatically.

This is why the 28-year shift test is useful as a backtest integrity check.


Why the Shift Is Usually 28 Years

A 28-year shift is commonly used because it usually preserves the weekday structure of the calendar.

This matters because many Expert Advisors legitimately use:

  • day-of-week filters;
  • Friday close rules;
  • Monday open filters;
  • trading sessions;
  • rollover logic;
  • intraday trading windows;
  • time-based restrictions.

If the data is shifted by a random number of years, the calendar structure may become distorted. Monday may become Wednesday, Friday logic may no longer apply correctly, and weekly filters may create unnecessary noise in the comparison.

A 28-year shift makes the comparison cleaner: the calendar dates change, but the weekly structure remains much more comparable.


What a Robust Expert Advisor Should Show

If an EA does not depend on specific historical dates, the shifted test should show broadly similar behavior.

The goal is not to compare only net profit. The full structure of the test matters.

What to CompareWhy It Matters
Equity curveShows whether the strategy behavior remains similar
Number of tradesA large difference may indicate date or time filters
Profit factorShows whether the trading edge remains intact
Expected payoffShows the average result per trade
DrawdownShows whether the risk profile changes
Win rateHelps identify a change in trade behavior
Trade listHelps locate where the differences begin
Profit distribution by periodShows whether stability disappears

A normal result does not require every trade to match perfectly. A normal result means that the overall logic and performance profile remain reasonably consistent.

If the original backtest shows smooth growth, while the shifted test becomes chaotic or unprofitable, this is a serious warning signal.


Suspicious Results in a 28-Year Shift Test

1. The Number of Trades Changes Dramatically

If the EA opens far fewer or far more trades after the shift, the logic may be highly dependent on calendar conditions.

For example, if the original test had 800 trades and the shifted test has 300, or the original test had 500 trades and the shifted test has 1,200, the difference requires investigation.

2. A Profitable Strategy Becomes Unprofitable

If the standard backtest shows stable profits but the shifted test becomes negative, this is one of the strongest warning signs.

This does not automatically prove that the EA is fraudulent. But it does mean the original backtest should not be trusted without deeper verification.

3. The Equity Curve Changes Completely

Sometimes the final profit may not collapse entirely, but the shape of the equity curve changes. Long drawdowns appear, stability disappears, or most of the profit becomes concentrated in one short period.

This is also a problem. A robust strategy should retain its basic behavior under reasonable stress tests.

4. The EA Avoided Only the Worst Market Phases

The most suspicious scenario is when the original backtest avoids the worst losing zones, but after the shift the EA starts trading those same market movements and takes losses.

This may indicate a hidden blacklist of historical dates.


Practical Example: Gold or MT4 With a Standard Backtest and a 28-Year Shift

To demonstrate the value of this test, we ran two tests of the Gold or MT4 Expert Advisor on XAUUSD, H1 in MetaTrader 4 using Tick Data Suite.

Tick Data Suite  Forex Expert Advisors Using the 28-Year Shift Test

The first test was a standard backtest on the original historical period.
The second test used the 28-year shift function, where the data is shifted 28 years into the past.

Important note: in the shifted report, the Strategy Tester displays an older calendar period. This does not mean the EA was tested on an unrelated independent market history. The purpose of the test is to keep the market sequence comparable while changing the calendar dates.

What the Standard Backtest Shows

In the standard backtest, the EA looks highly attractive. The equity curve rises smoothly, drawdowns look controlled, and the overall result creates the impression of a stable profitable system.

If we looked only at this report, it would be easy to assume that the EA has a strong trading edge. This is exactly where the risk begins: a visually attractive backtest can create a false sense of reliability.

The chart looks comfortable: consistent growth, no long destructive stagnation, and a strong recovery after local drawdowns. For a commercial Expert Advisor, this is not proof of quality. It is a reason to perform additional stress testing.

What the 28-Year Shift Test Shows

After enabling the 28-year shift, the picture changes sharply.

Instead of smooth growth, the shifted test shows a much more unstable equity curve with visible drawdowns. The EA no longer looks like a system with a reliable edge. The overall performance profile becomes significantly weaker, and the original impression from the standard backtest breaks down.

The key issue is not one specific number from the report. The key issue is the nature of the change:

  • the equity curve loses its stable upward structure;
  • the result no longer looks convincingly profitable;
  • drawdown becomes much more dangerous relative to the deposit;
  • the trade structure changes;
  • the original trading edge nearly disappears.

This contrast between the standard test and the shifted test is a serious warning signal.

What This Result Means

This example shows why the 28-year shift test is useful.

If an Expert Advisor is based on robust market logic, it does not need to produce an identical result after the shift. But it should retain a similar behavior profile. In this case, the difference is too large: the standard backtest shows an attractive system, while the shifted test shows a completely different risk and return profile.

Possible explanations include:

  1. The EA may be heavily fitted to the original historical period.
  2. The EA logic may depend on specific calendar dates.
  3. Hidden date-sensitive filters may be used internally.
  4. The result may be sensitive to GMT/DST, rollover, session logic, or other time-based conditions.
  5. The standard backtest may overestimate the real robustness of the system.

This is not automatic proof of fraud. Without access to the source code, we cannot claim that losing dates were intentionally hardcoded into the EA. However, the professional conclusion is clear: the original backtest should not be trusted on its own.


How to Prepare Shifted Quotes Without Tick Data Suite

If you do not have Tick Data Suite, you can still reproduce the basic idea of a 28-year shift test manually. The workflow is simple: export historical quotes, shift all dates 28 years into the past, import the modified data back into MetaTrader, and run the same Expert Advisor with the same settings.

This is not a full replacement for TDS, especially for scalpers and strategies that depend heavily on tick data, variable spread, and execution quality. However, as a rough integrity check, it can still help reveal whether an EA is overly dependent on specific calendar dates.

The core idea is to preserve the same price sequence while changing only the calendar dates. For example, this quote:

2022.01.10 01:00, 1820.50, 1822.10, 1819.80, 1821.40

would become:

1994.01.10 01:00, 1820.50, 1822.10, 1819.80, 1821.40

Only the date changes. Open, High, Low, Close, volume, and intraday time should remain unchanged.

For MT4, historical data can be exported through:

Tools → History Center → Symbol → Timeframe → Export

For MT5, use:

Tools → History Center → Bars → Select symbol and timeframe → Export Bars

For a manual check, it is usually better to use OHLC bar data rather than tick data. H1 is suitable for medium-term EAs, M15 is more appropriate for intraday systems, and M5 may be used for more precise intraday strategies. For scalpers, this manual method is generally not recommended because the result may be too sensitive to tick quality, spread modelling, and execution assumptions.

After exporting the data, shift every date 28 years into the past. For example:

Original DateShifted Date
2022.01.101994.01.10
2023.06.151995.06.15
2024.11.191996.11.19

You can write a small script for this task using any AI coding assistant or neural network. The instruction is straightforward: take the exported quote file, subtract 28 years from each date, and save a new file without changing prices, time, volume, or other fields.

The basic logic is:

New date = original date - 28 years

The most important rule is that only the date field should be modified. The market data itself must remain unchanged.

Once the file is prepared, import it back into MetaTrader. It is better to use a separate test terminal rather than your main trading installation. In MT4, import the file through:

Tools → History Center → Symbol → Timeframe → Import

In MT5, the safer method is to create a custom symbol and import the shifted bars into it:

Market Watch → Symbols → Create Custom Symbol → Import Bars

Using a custom symbol in MT5 is preferable because it avoids overwriting the historical data of a real broker symbol.

Then run the same EA in the Strategy Tester. Use the same EA version, set file, symbol or custom symbol, timeframe, initial deposit, risk settings, input parameters, spread settings, and commission settings if available. Only the quote dates should be different.

For example, if the original test period was:

2022.01.10 — 2025.11.19

the shifted period becomes:

1994.01.10 — 1997.11.19

When comparing results, do not focus only on final net profit. Compare the full structure of the test: equity curve, number of trades, profit factor, drawdown, win rate, and trade list. The key question is whether the strategy preserved its general behavior after the calendar dates changed.

If an EA performs well on the original data but deteriorates sharply after the same quotes are shifted to another calendar period, this is a serious robustness warning. It may indicate that the EA is sensitive to specific dates, hidden calendar filters, or the original historical configuration.

At the same time, this manual method has clear limitations. True tick data is difficult to shift and re-import correctly. Variable spread may not be preserved accurately. Commission, swap, GMT/DST, and session logic may be modelled differently. Broker data may also overwrite imported history if the terminal is not isolated. For scalping systems, the result may be too approximate to be reliable.

Therefore, a manual quote-shift test should be treated as a preliminary filter, not as a perfect replacement for Tick Data Suite or a complete tick-data testing workflow. Still, it is better than relying only on a vendor backtest. The main principle remains simple: only dates change; prices stay the same. If the equity curve, trade count, and risk profile change dramatically, the EA requires deeper analysis before it can be trusted.


Why a Failed Shift Test Does Not Always Mean Fraud

It is important to be precise: different results after the shift do not automatically prove that the EA is fraudulent.

There may be legitimate reasons why an Expert Advisor behaves differently.

News Filters

If the EA uses an economic calendar, the shifted dates will no longer match the same market movements. This can change the trade list.

In this case, the trader should check whether the news filter can be disabled and how the result changes without it.

GMT, DST, and Trading Sessions

Many Expert Advisors trade only during specific hours. This is especially important for night scalpers, Asian-session scalpers, and systems that depend on the opening or closing of trading sessions.

If time settings are handled differently, the result may change for technical reasons.

Rollover, Swap, and Friday Close

EAs that hold trades overnight or through the weekend may be sensitive to rollover, swap, spread widening, and Friday close rules.

Seasonal Logic

Some strategies may use end-of-month, end-of-quarter, holiday periods, or other calendar effects. This is not necessarily a problem if the logic is clearly disclosed.

The main rule is simple: if the shifted result is dramatically different, the developer should be able to explain why. If there is no clear explanation, the risk increases significantly.


Conclusion

The 28-year shift test is one of the most practical ways to check whether a Forex Expert Advisor depends on specific historical dates or whether its backtest may be artificially improved.

The logic of the test is simple: if the market movements remain comparable but the calendar dates change, a robust strategy should preserve a similar behavior profile. If the EA sharply loses profitability, changes its trade structure, and produces a completely different equity curve, this is a serious risk signal.

The Gold or MT4 example shows why this check matters. A standard backtest can look convincing, but a shifted test may reveal weakness that is not visible on a polished equity curve.

A failed 28-year shift test does not automatically prove manipulation. But it does mean that the EA requires deeper due diligence: fresh data testing, out-of-sample validation, spread and slippage stress tests, broker comparison, and real monitoring.

For practical algorithmic traders, the main conclusion is clear:

A beautiful backtest is only the beginning of the evaluation process. A reliable Expert Advisor must remain stable outside its most convenient historical configuration.

An EA that produces strong profits only on one original historical setup, but loses its edge after the calendar is shifted, should not be treated as a proven trading system. It is a risk hidden behind an attractive equity curve.

You can see a catalog of advisors that we tested with real spreads on high-quality tick history on this page.


Subscribe to our channel, here you will find the best 👇