DeepSeek Trading Strategy Backtesting Framework Prompt

Build a rigorous backtesting framework for any trading strategy — entry and exit rules, performance metrics, and how to avoid overfitting.

Category
📊 Trading
Difficulty
Advanced
Models
3
Last Updated
2026-06-29
📊 Trading Advanced backtesting trading strategy quantitative trading strategy validation
Works with
📋 Prompt
You are a quantitative analyst and trading strategy developer who has backtested 200+ strategies.

DISCLAIMER: Educational only — not financial advice. Past performance does not guarantee future results. Trading involves significant risk of loss.

Strategy description: [describe your trading strategy — entry signal, exit signal, timeframe, instrument]
Data available: [what historical data you have access to]
Backtest tool: [TradingView/Python/MT5/Excel/other]
Main concern: [overfitting / small sample size / curve fitting / realistic execution]

Task:
1. RULE SPECIFICATION: Convert your strategy description into precise, unambiguous if-then rules that can be coded or manually backtested
2. DATA REQUIREMENTS: Minimum sample size, lookback period, and why
3. PERFORMANCE METRICS: Which metrics to track and what good looks like for each
4. OVERFITTING PREVENTION: How to avoid building a strategy that only worked in the past
5. EXECUTION REALISM: How to account for spread, slippage, and commission in backtest results
6. WALK-FORWARD TESTING: How to validate the strategy on unseen data
7. GO/NO-GO CRITERIA: Minimum thresholds a strategy must pass before live trading
BACKTESTING FRAMEWORK: XAU/USD Session Sweep Strategy
DISCLAIMER: Educational — not financial advice. Past results do not guarantee future returns.

RULE SPECIFICATION (precise and codeable):
ENTRY CONDITIONS (all must be true):
1. London session (07:00-10:00 GMT) or NY open (13:00-15:00 GMT)
2. Price sweeps the session low (defined as the lowest low of the previous 2 hours) — wick goes below it by at least 3 pips
3. The 15M candle that swept the low CLOSES above the sweep level
4. RSI(14) on the 15M is below 40 at the time of the close
5. No major news event within 30 minutes (check in advance)

STOP LOSS: Below the sweep wick low plus spread plus 5 pip buffer
TAKE PROFIT: 2× the stop loss distance (1:2 R:R)
TIME EXIT: Close any open trade at 11:00 GMT (end of London primary session) regardless of P&L

DATA REQUIREMENTS:
Minimum: 200 complete trade setups to have statistical significance
With your strategy triggering approximately 3-5 times per week: you need 40-65 weeks of data (roughly 12-15 months minimum)
Your 2 years of data is adequate — but use 18 months for development and 6 months held out for walk-forward test

PERFORMANCE METRICS:
Win rate: target above 45% for a 1:2 R:R system
Profit factor: gross profit / gross loss. Below 1.3 is weak. Above 1.5 is acceptable. Above 2.0 is strong.
Maximum drawdown: should be below 3× average monthly gain
Sharpe ratio: above 1.0 is acceptable; above 1.5 is strong
Expectancy: (win rate × avg win) - (loss rate × avg loss) must be positive

OVERFITTING PREVENTION:
1. Minimum 3 parameters in the rule — you have 5 (sweep size, candle close, RSI level, session times, R:R). Fewer parameters = less overfitting risk.
2. Do not optimise RSI level, sweep pip size, or R:R on the same data you test on — pick your parameters first then test them
3. If changing any single parameter by 10% destroys the results, the strategy is fragile
4. Walk-forward test on the held-out 6 months BEFORE going live

GO/NO-GO CRITERIA:
Minimum 150 trades in backtest (ideally 200+)
Profit factor above 1.4
Maximum drawdown below 15%
Walk-forward results within 30% of backtest results (not dramatically worse)
If any criterion fails: do not trade live — refine the rules and retest
🏆
Best model for this prompt
Claude
Claude (Opus 4 / Sonnet 4)
💡 Pro Tips
A strategy needs at least 100-200 trades in the backtest for any statistical conclusions — fewer trades may just be lucky noise
The walk-forward test on unseen data is the most important test — if the strategy fails on the held-out period, it was overfit
Realistic spread and slippage can destroy the profitability of strategies that look great on paper — XAU/USD has 25-80 pip spreads in high volatility; always model worst-case spread
The best strategies have simple rules — if you need 10 conditions to enter a trade, you are probably curve fitting to historical accidents
⚠️ Common Mistakes
Testing on all available data and then trading live — you have no unseen validation data and no way to know if results were random
Optimising parameters on historical data then claiming those parameters are correct — this is guaranteed overfitting
Not accounting for spread and commission — strategies that look profitable at zero spread often fail in live markets
Small sample sizes — 30 trades proving a strategy works is not proof of anything; it is the minimum required to start thinking about it seriously
❓ FAQ 🔗 Related Prompts