Historical Data for BackTesting

- 4 mins read

One of the most important aspects of backtesting trading strategies is acquiring accurate and reliable historical data. Without quality data, even the most sophisticated strategies can fail or lead to misleading results. In this post, we’ll look at different ways to fetch historical data for backtesting using various platforms, including both paid and free options, and I’ll introduce you to Syncra, a tool I built for working with MetaTrader and Binance data.

Oanda

Oanda offers a comprehensive range of historical data, making it a go-to for many traders. Their data spans multiple asset classes, including forex, commodities, indices, and even cryptocurrencies. You can access historical data directly from their API for any backtesting purpose. Oanda’s data is high-quality and provides granular tick-level data for specific timeframes.

To use Oanda’s data, you’ll need to create an account and get API access, but you’ll need to ensure you’re using their API properly to extract the data in a structured way for analysis.

TickStory

TickStory provides an excellent data service for forex traders, allowing them to download free historical tick data. TickStory is particularly useful for MetaTrader users, as it integrates directly with MT4/MT5 platforms. You can use TickStory to download historical data, perform backtests, and even import that data into MT4.

It supports multiple timeframes and can help prepare your data to work seamlessly with MetaTrader. While TickStory’s free tier offers limited data, it’s still a great option to get started with.

Free Platforms for Historical Data

Dukascopy

Dukascopy offers free historical data through its MT5 platform. Their data is well-regarded and spans a wide range of markets, including forex, commodities, and indices. Dukascopy’s data is available for download in CSV format, which makes it easy to import into backtesting tools like Python or MetaTrader.

While Dukascopy doesn’t offer tick data for all asset classes, their historical data is perfect for most traders who are getting started and want to test strategies without incurring additional costs.

Darwinex

Darwinex is another free platform that provides historical data for forex and equity markets. Their data can be accessed via MT5 and is typically well-suited for algorithmic traders. The data is clean and supports multiple timeframes, so you can perform effective backtests across different strategies.

Syncra: A Tool for Fetching MetaTrader and Binance Data

I built Syncra, a platform designed to help you easily extract historical data from MetaTrader and Binance, then store it in Parquet files. Parquet is a highly efficient columnar storage format, which greatly reduces the size of your data files while maintaining fast read speeds for analysis.

Syncra supports MetaTrader data (MT4/MT5) and Binance, making it a perfect tool for traders who want to quickly extract data from these platforms for backtesting. It simplifies the process of collecting and storing data in a format that is easy to work with, saving you valuable time.

You can find Syncra on GitHub here.

Preprocessing Data Before Strategy Implementation

Before implementing any strategies, it’s essential to preprocess the data to ensure it’s in the right format. This step can include cleaning the data, adjusting for missing values, converting timezones, or even aggregating data from different timeframes.

I’ve built a set of utility functions in another GitHub repository that help with data extraction and manipulation. These functions allow you to extract bar data from parquet files according to the structure used by Syncra.

Check out the repository with the preprocessing utilities here.

Conclusion

Acquiring accurate historical data is critical for backtesting your trading strategies. Platforms like Oanda, TickStory, Dukascopy, and Darwinex offer both free and paid data options, allowing you to gather data based on your needs.

For MetaTrader and Binance users, Syncra is an excellent tool for extracting data and storing it efficiently. And don’t forget to preprocess your data before diving into strategy implementation—using utility functions can save you a lot of time and headaches.

If you need my help properly setting Syncra up, I’m one email away, but the README should be sufficient to get you started.

Now that you know how to get and prepare your data, it’s time to move on to the fun part: implementing and testing your strategies! Happy trading!