
On the surface, backtesting a forex strategy seems simple: get the data, run your logic, check the results. But the reality is, the real headache isn’t the strategy itself—it’s the data.
Especially when using a free forex historical data API, one recurring problem always pops up: weekend gaps.
Markets close on weekends. That’s obvious. But your system doesn’t understand that—it just sees a blank in the time series. Suddenly, indicators act erratically, signals get distorted, and your backtest results look “too good to be true.”
Weekend gaps are trickier than they seem
Forex markets pause from Friday close until Monday open. But how the data system handles that “blank period” varies.
Some leave the gap as-is; others fill it in neatly. Either way, problems appear. If data is missing, moving averages get pulled weirdly, oscillators misread volatility, and even simple buy/sell signals can become unreliable.
The sneakiest issue is “too clean” data. It looks fine at first glance, but in reality, it doesn’t reflect the actual market structure. That kind of illusion can be more dangerous than the gaps themselves.
Continuity is the real key
Every strategy, no matter how simple or complex, assumes one thing: time flows continuously, and prices update steadily.
Weekends break that assumption. Without continuity, indicators misfire, volatility gets over- or under-estimated, and strategy performance can be seriously off. Often, what looks like a successful strategy is just an artifact of the data.
In backtesting, continuity is the foundation. If the foundation wobbles, everything built on it is shaky.
Choosing the right data API
When selecting a free forex historical data API, “free” isn’t enough. Quality matters.
Key points to check:
- Are timestamps consistent, without duplicates or jumps?
- Is weekend data clearly handled, not just disappearing?
- Does it support multiple granularities, from minute-level to daily candles?
- Are OHLC values clean and complete?
Many free APIs fall short: data is too coarse, timeframes get compressed, or multiple sources are mixed, breaking reproducibility.
For more stable setups, platforms like AllTick API emphasize keeping the time structure intact, ensuring weekend gaps don’t destroy continuity and letting you focus on strategy testing rather than messy data cleanup.
Handling weekend gaps
There isn’t a single correct approach; it depends on your strategy.
- Leaving the gaps as-is is most realistic, suitable for medium- to long-term strategies.
- Forward-filling with Friday’s close is simple but compresses volatility.
- Filling weekends with flat “ghost candles” creates a smooth, inactive period.
- A stricter approach is to segment by trading session and recalculate indicators—more complex, but precise.
Basic workflow for backtesting
A typical, stable workflow looks like this:
- Retrieve data
- Normalize timestamps and timezones
- Handle weekend gaps
- Calculate indicators
- Generate buy/sell signals
- Evaluate performance
It sounds straightforward, but even one flawed step can distort the entire result.
Common mistakes
Many people underestimate data quality. They mix sources, ignore time zones, or just think “close enough.”
The result: backtests look great, but live performance behaves completely differently.
Takeaways
The critical factor isn’t the complexity of your strategy—it’s data reliability.
Weekend gaps must be handled. Continuity is essential. Choosing the right data API is key.
Once your data is stable, strategy refinement and testing finally become meaningful.


