Custom Out-of-Sample Testing System for Crypto Trading Strategies

You wrote a crypto strategy that looks brilliant in backtests but blows up a demo account within a week? The cause is overfitting to past data. We build out-of-sample testing systems that integrate into your algorithmic pipeline and filter out such strategies before risking real capital. Our team delivers turnkey projects—from audit to deployment and ongoing support.

Blockchain Development Services

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1335
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1293
  • B2B Advance company logo design
    B2B Advance company logo design
    738
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1031
  • AIDER company logo development
    AIDER company logo development
    978
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1087

You wrote a trading strategy: on Ethereum historical data it shows a Sharpe of 2.8, max drawdown 12%, win rate 65%. You launch it on a demo account — a week later you're down 40%. The reason: overfitting to history. Out-of-sample (OOS) testing is the only way to filter out such strategies before you risk real capital. We build custom OOS testing systems that integrate into your algorithmic pipeline.

Our experience in this area: 5+ years developing trading systems for cryptocurrencies, over 60 completed projects, including DeFi frameworks for arbitrage and market making. We guarantee correct implementation: all checks are tested on synthetic data with known answers. We provide full code, documentation, and consultations.

What is out-of-sample testing and why is it needed?

Out-of-sample (OOS) testing is the evaluation of a trading strategy on data that was not used during its creation. It filters out overfitted algorithms before they hit a real account. Without OOS, you risk capital based on random coincidences in historical data.

What problems does OOS testing solve?

Overfitting. If a strategy works only on the data it was tuned on, it's useless. An OOS test reveals true generalization ability. We use statistical tests (t-test, effective sample size corrected for autocorrelation) to assess significance of OOS results. In our practice, 70% of strategies that pass IS optimization fail OOS validation.

Look-ahead bias and data leakage. A common mistake: when splitting into IS/OOS, indicators that use future data are not shifted. We automatically verify that the OOS period is fully isolated: the last 20% of chronology. The split code is always strict, with date checks.

Statistical insignificance. A small sample or high autocorrelation makes results random. Our framework calculates p-value for OOS returns and adjusts the number of effective observations. Only if p < 0.05 and Sharpe > 0.5 is the strategy allowed for deployment.

How we do it

Tech stack: Python 3.10+, pandas, scipy, numpy. We use unit testing for validation components. The client receives not only a report but also an interactive dashboard with metrics: Sharpe degradation, drawdowns, win rate.

Example from a recent case: for a DeFi arbitrage bot on Polygon, we implemented OOS validation with walk-forward optimization. On OOS data, Sharpe dropped from 3.2 to 1.8, but remained statistically significant (p=0.01). The client declined deployment, saving about $12k in fees and liquidity. Such a check is worth the investment.

Validation framework

import pandas as pd

def create_oos_split(data: pd.DataFrame, oos_pct: float = 0.20) -> tuple:
    """ Create strict IS/OOS split. OOS is the last 20% of data chronologically. """
    split_idx = int(len(data) * (1 - oos_pct))
    in_sample = data.iloc[:split_idx]
    out_of_sample = data.iloc[split_idx:]
    print(f"In-sample: {in_sample.index[0].date()} → {in_sample.index[-1].date()} ({len(in_sample)} bars)")
    print(f"Out-of-sample: {out_of_sample.index[0].date()} → {out_of_sample.index[-1].date()} ({len(out_of_sample)} bars)")
    return in_sample, out_of_sample
class OOSValidator:
    def __init__(self, backtester, significance_threshold: float = 0.05):
        self.backtester = backtester
        self.alpha = significance_threshold

    def validate(
        self,
        strategy_params: dict,
        is_result: BacktestResult,
        oos_data: pd.DataFrame,
    ) -> OOSValidationReport:
        # Run final test on OOS data
        oos_result = self.backtester.run(strategy_params, oos_data)

        # Statistical significance of OOS results
        oos_returns = oos_result.equity_curve.pct_change().dropna()
        significance = self._test_significance(oos_returns)

        # Compare IS vs OOS
        is_vs_oos = self._compare_is_oos(is_result, oos_result)

        # Verdict
        passed = self._evaluate_verdict(oos_result, significance, is_vs_oos)

        return OOSValidationReport(
            is_result=is_result,
            oos_result=oos_result,
            significance=significance,
            is_vs_oos_comparison=is_vs_oos,
            passed=passed,
            recommendation=self._get_recommendation(passed, is_vs_oos),
        )

    def _test_significance(self, returns: pd.Series) -> dict:
        """Test statistical significance of positive returns"""
        from scipy import stats

        # t-test: H0: mean return == 0
        t_stat, p_value = stats.ttest_1samp(returns, 0)

        # Number of independent observations accounting for autocorrelation
        n_effective = self._effective_sample_size(returns)

        return {
            't_statistic': t_stat,
            'p_value': p_value,
            'is_significant': p_value < self.alpha and t_stat > 0,
            'n_effective': n_effective,
        }

    def _effective_sample_size(self, returns: pd.Series) -> float:
        """Adjust sample size for autocorrelation"""
        n = len(returns)
        autocorr = returns.autocorr(1)
        if abs(autocorr) >= 1:
            return n
        return n * (1 - autocorr) / (1 + autocorr)

    def _compare_is_oos(self, is_result: BacktestResult, oos_result: BacktestResult) -> dict:
        is_m = is_result.metrics
        oos_m = oos_result.metrics
        return {
            'sharpe_ratio_degradation': (is_m.sharpe_ratio - oos_m.sharpe_ratio) / max(abs(is_m.sharpe_ratio), 0.01),
            'return_ratio': oos_m.annual_return_pct / max(is_m.annual_return_pct, 0.01),
            'drawdown_ratio': oos_m.max_drawdown_pct / max(abs(is_m.max_drawdown_pct), 0.01),
            'win_rate_change': oos_m.win_rate - is_m.win_rate,
        }

    def _evaluate_verdict(self, oos_result, significance, comparison) -> bool:
        # Criteria for passing OOS test
        checks = [
            oos_result.metrics.sharpe_ratio > 0.5,  # positive Sharpe
            significance['is_significant'],  # statistically significant
            comparison['sharpe_ratio_degradation'] < 0.7,  # degradation < 70%
            oos_result.metrics.max_drawdown_pct > -40,  # drawdown < 40%
            oos_result.metrics.total_trades >= 15,  # enough trades
        ]
        return all(checks)

# Function to print report
def print_oos_report(report: OOSValidationReport):
    print("=" * 60)
    print("OOS VALIDATION REPORT")
    print("=" * 60)
    print(f"\n{'IS':25} {'OOS':>10}")
    print("-" * 40)
    print(f"{'Sharpe Ratio':25} {report.is_result.metrics.sharpe_ratio:>10.2f} {report.oos_result.metrics.sharpe_ratio:>10.2f}")
    print(f"{'Annual Return %':25} {report.is_result.metrics.annual_return_pct:>10.1f} {report.oos_result.metrics.annual_return_pct:>10.1f}")
    print(f"{'Max Drawdown %':25} {report.is_result.metrics.max_drawdown_pct:>10.1f} {report.oos_result.metrics.max_drawdown_pct:>10.1f}")
    print(f"{'Win Rate %':25} {report.is_result.metrics.win_rate*100:>10.1f} {report.oos_result.metrics.win_rate*100:>10.1f}")
    comp = report.is_vs_oos_comparison
    print(f"\nSharpe degradation: {comp['sharpe_ratio_degradation']:.1%}")
    print(f"OOS/IS return ratio: {comp['return_ratio']:.2f}x")
    sig = report.significance
    print(f"\nStatistical significance: p={sig['p_value']:.4f} (significant: {sig['is_significant']})")
    print(f"Effective sample size: {sig['n_effective']:.0f}")
    verdict = "PASSED" if report.passed else "FAILED"
    print(f"\n{'='*20} {verdict} {'='*20}")
    print(f"Recommendation: {report.recommendation}")

How to determine the correct data split?

One key question is what percentage of data to allocate to OOS. Standard: 70/20/10 (IS/OOS/validation) or 80/20 for simple cases. For walk-forward optimization we use a rolling window: 12 months IS, 3 months OOS. Cryptocurrencies require more frequent recalibration — once a month.

Metric In-Sample Out-of-Sample Acceptable Deviation
Sharpe Ratio 2.0 – 3.0 > 0.5 Degradation < 70%
Annual Return 30% – 60% > 0% Reduction by 2–3x
Max Drawdown < 20% < 40% Increase up to 2x
Win Rate 55% – 70% > 50% Decrease up to 10%

How to evaluate statistical significance of OOS results?

For significance evaluation we use the t-test and sample size adjustment for autocorrelation. If p-value < 0.05 and Sharpe > 0.5, the strategy is considered to have passed OOS validation. More about the t-test can be read on Wikipedia.

Process of work

Stage What we do Result
Analytics Gather requirements: asset types, trade frequency, time frames Technical specification
Design Develop architecture: data split, validation classes, integration with backtester Architecture documentation
Implementation Write prototype in Python considering your stack Repository with code
Testing Validate on synthetic data, test for known bugs (look-ahead bias, data snooping) Validation report
Deployment Integrate into CI/CD pipeline, train the team Access to system + documentation

Why are OOS results always worse than IS?

This is expected: the strategy is fitted to IS, so degradation on new data is inevitable. What matters is not the absolute difference but its reasonableness: Sharpe degradation no more than 70%, OOS returns positive. If OOS is better than IS, it's a symptom of look-ahead bias and needs rechecking.

Typical mistakes in OOS testing

  • Looking at OOS before finalizing the strategy. One glance is enough to make the data no longer out-of-sample.
  • Using random split instead of chronological. Trading is a time series; random shuffling destroys temporal structure.
  • Not checking statistical significance. With few trades (less than 15), any result is random.
  • Ignoring autocorrelation. Daily returns are correlated; effective sample size is smaller.

Due to look-ahead bias, one of our clients lost over $20k on a real account. Preventing such losses is the purpose of OOS testing.

What's included in the work (deliverables)

  • OOS validation framework with source code and tests
  • Integration with your backtester (Python libraries)
  • Report explaining metrics and recommendations
  • Documentation on usage and customization
  • Access to repository with change history
  • Consultation support for 30 days

Order the implementation of OOS testing — contact us for a consultation. We will evaluate your strategy and propose an optimal solution. Get a consultation without obligations. Alternatively, if you want to test an existing strategy, our team can perform an audit in 1-2 days.