Backtesting Frameworks

Backtesting Frameworks

Guides an AI coding agent to build trustworthy backtesting systems for trading strategies, avoiding look-ahead and survivorship bias and modelling transaction costs.

Skill files2 files

references/

SKILL.md86 lines
1
---
2
name: backtesting-frameworks
3
description: Build robust backtesting systems for trading strategies with proper handling of look-ahead bias, survivorship bias, and transaction costs. Use when developing trading algorithms, validating strategies, or building backtesting infrastructure.
4
---
5
6
# Backtesting Frameworks
7
8
Build robust, production-grade backtesting systems that avoid common pitfalls and produce reliable strategy performance estimates.
9
10
## When to Use This Skill
11
12
- Developing trading strategy backtests
13
- Building backtesting infrastructure
14
- Validating strategy performance
15
- Avoiding common backtesting biases
16
- Implementing walk-forward analysis
17
- Comparing strategy alternatives
18
19
## Core Concepts
20
21
### 1. Backtesting Biases
22
23
| Bias | Description | Mitigation |
24
| ---------------- | ------------------------- | ----------------------- |
25
| **Look-ahead** | Using future information | Point-in-time data |
26
| **Survivorship** | Only testing on survivors | Use delisted securities |
27
| **Overfitting** | Curve-fitting to history | Out-of-sample testing |
28
| **Selection** | Cherry-picking strategies | Pre-registration |
29
| **Transaction** | Ignoring trading costs | Realistic cost models |
30
31
### 2. Proper Backtest Structure
32
33
```
34
Historical Data
35
│
36
▼
37
┌─────────────────────────────────────────┐
38
│ Training Set │
39
│ (Strategy Development & Optimization) │
40
└─────────────────────────────────────────┘
41
│
42
▼
43
┌─────────────────────────────────────────┐
44
│ Validation Set │
45
│ (Parameter Selection, No Peeking) │
46
└─────────────────────────────────────────┘
47
│
48
▼
49
┌─────────────────────────────────────────┐
50
│ Test Set │
51
│ (Final Performance Evaluation) │
52
└─────────────────────────────────────────┘
53
```
54
55
### 3. Walk-Forward Analysis
56
57
```
58
Window 1: [Train──────][Test]
59
Window 2: [Train──────][Test]
60
Window 3: [Train──────][Test]
61
Window 4: [Train──────][Test]
62
─────▶ Time
63
```
64
65
## Detailed worked examples and patterns
66
67
Detailed sections (starting with `## Implementation Patterns`) live in `references/details.md`. Read that file when the navigation summary above is insufficient.
68
69
## Best Practices
70
71
### Do's
72
73
- **Use point-in-time data** - Avoid look-ahead bias
74
- **Include transaction costs** - Realistic estimates
75
- **Test out-of-sample** - Always reserve data
76
- **Use walk-forward** - Not just train/test
77
- **Monte Carlo analysis** - Understand uncertainty
78
79
### Don'ts
80
81
- **Don't overfit** - Limit parameters
82
- **Don't ignore survivorship** - Include delisted
83
- **Don't use adjusted data carelessly** - Understand adjustments
84
- **Don't optimize on full history** - Reserve test set
85
- **Don't ignore capacity** - Market impact matters
86

© Seth Hobson · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…