📊 What is Backtesting with the Out of Sample (OOS) Technique?
📊 What is Backtesting with the Out of Sample (OOS) Technique?


🔍 What is Backtesting?
Backtesting is the process of evaluating a trading strategy or Expert Advisor (EA) by running it on historical market data. The goal is to understand how the strategy would have performed in the past, which can provide insight into how it might behave in the future.
However, one of the most common pitfalls in backtesting is overfitting—when a strategy performs exceptionally well on historical data simply because it was excessively tailored to that specific dataset. That’s where the Out of Sample (OOS) technique comes in.
🧠 What is Out of Sample Testing?
Out of Sample testing is a method where the historical data is divided into two parts:
In Sample (IS): This portion of the data is used to develop, train, and optimize the trading strategy.
Out of Sample (OOS): This portion is kept separate and is not used during strategy development. It is reserved for testing the strategy's performance on unseen data.
Think of it like studying for an exam:
In Sample is your study time.
Out of Sample is the actual test — no help allowed.
This technique simulates real-world conditions where the market is unknown and helps verify if a strategy can truly adapt to new environments.
✅ Why Use OOS Testing?
Avoid Overfitting
Strategies optimized only on In Sample data may look great in backtests but fail in live markets. OOS helps filter out such "overtrained" strategies.
Objective Validation
OOS testing provides an unbiased performance review, similar to how the strategy would behave in a real account with future market data.
Greater Confidence
A strategy that performs well on both In Sample and Out of Sample periods is more likely to be robust and reliable in live trading.
Avoid Overfitting
Strategies optimized only on In Sample data may look great in backtests but fail in live markets. OOS helps filter out such "overtrained" strategies.
Objective Validation
OOS testing provides an unbiased performance review, similar to how the strategy would behave in a real account with future market data.
Greater Confidence
A strategy that performs well on both In Sample and Out of Sample periods is more likely to be robust and reliable in live trading.
🛠️ How to Do OOS Backtesting (Step-by-Step)
Collect Historical Data
Use high-quality historical price data, ideally tick-level or 1-minute bars.
Split the Data
For example, if you backtest one year of data:
First 9 months → In Sample
Last 3 months → Out of Sample
Optimize in the In Sample Period
Adjust parameters to improve performance using only the In Sample data.
Test on Out of Sample Data
Run the EA with the same parameters on the OOS data — no tweaking allowed.
Compare Results
Check for consistency in profit, drawdown, and other key metrics across both periods.
Collect Historical Data
Use high-quality historical price data, ideally tick-level or 1-minute bars.
Split the Data
For example, if you backtest one year of data:
First 9 months → In Sample
Last 3 months → Out of Sample
Optimize in the In Sample Period
Adjust parameters to improve performance using only the In Sample data.
Test on Out of Sample Data
Run the EA with the same parameters on the OOS data — no tweaking allowed.
Compare Results
Check for consistency in profit, drawdown, and other key metrics across both periods.
📌 Final Thoughts
Out of Sample testing is an essential step in the EA development process. It protects you from false confidence based on overfitted results and gives you a clearer picture of your strategy’s true potential.
If your EA can succeed in both the familiar (In Sample) and the unknown (Out of Sample), it's much more likely to succeed in real-world trading.
See video Tutorial >>> https://www.youtube.com/watch?v=V7lSULKoZm4&t=3s&pp=ygUHcmVhZGJvdA%3D%3D
Komentar
Posting Komentar