ml4t-run-backtest skillA
ml4t-run-backtest is agent-read markdown (skill) from ml4t/skills: Event-driven backtesting with realistic order execution, position tracking, and performance measurement. Use when simulating a trading strategy on historical data..
Indexed from public GitHub and served as immutable, content-addressed versions. Install it pinned to an exact SHA-256 with the mdr CLI, and every file is verified against the hash recorded here before it reaches your agent. The deterministic audit below grades the latest version, and the same file always earns the same grade.
What the file says
# Event-Driven Backtesting
Vectorized backtests hide execution reality. Event-driven simulation processes each bar sequentially, submitting orders that fill at future prices - the only way to model what actually happens when you trade.
## The Problem
Vectorized `positions * returns` backtests assume instant fills at known prices. In reality, you decide to trade on bar _t_ but fill at bar _t+1_. Ignoring this inflates Sharpe by 0.3-0.5 or more for daily strategies. The faster the signal, the larger the gap.
## The Pattern
### WRONG
```python
# Vectorized: signal and fill use the SAME bar's price
signals = compute_signal(prices) # uses close[t]
positions = np.where(signals > 0, 1, 0) # no shift!
returns = prices.pct_change()
strategy_returns = positions * returns # lookahead: traded at price used to decide
sharpe = strategy_returns.mean() / strategy_returns.std() * np.sqrt(252)
```
### CORRECT
```python
import numpy as np
def event_backtest(prices: np.ndarray, signal_fn, cost_bps: float = 10):
"""Minimal event-driven backtest: decide on bar t, fill on bar t+1."""
n = len(prices)
cash, shares = 100_000.0, 0
equity = np.zeros(n)
…Read the whole file at its exact version.
How to install
mdr add ml4t/skills/ml4t-run-backtest@git:20260901.c415df0mdr add ml4t/skills/ml4t-run-backtest@sha256:6c319d68bd8a933aPin to a label to follow the author's releases, or to a sha256 to freeze the exact bytes forever. Either way the resolved hash is written to mdr.lock, and mdr install reproduces it on any machine.
[](https://markdownregistry.com/a/art_wmk2tcncxlkeniuj)
1 badge views in 30 days
Versions
| version | committed | commit | size | audit | |
|---|---|---|---|---|---|
| git:20260901.c415df0 latest | 2026-09-01 | c415df0 | 4,094 B | A | view · diff |
| git:20260528.303089e | 2026-05-28 | 303089e | 4,110 B | A | view |
Audit of the latest version
- pass: Frontmatter block present
- pass: Frontmatter declares a name
- pass: Frontmatter declares a description
- pass: Size between 200 bytes and 200 KB (4094 bytes)
- pass: No zero-width or bidi control characters
- pass: No instruction hidden inside an HTML comment
- pass: No link to an exfiltration or paste host
- pass: No credential-shaped string
- pass: No instruction to send local credentials anywhere
- pass: No text hidden with inline styles
- pass: No prompt-injection phrasing
- pass: No curl or wget piped into a shell
- pass: No recursive delete of root, home or parent
- pass: No instruction to read or print local credentials
- pass: No base64 blob over 200 characters
- pass: No link to a raw IP address
- pass: No script tag
Source
ml4t/skills · 19 stars · license Apache-2.0 · pushed 2026-09-24 · branch main
API
GET https://markdownregistry.com/api/v1/artifacts/art_wmk2tcncxlkeniuj GET https://markdownregistry.com/api/v1/resolve?ref=ml4t/skills/ml4t-run-backtest GET https://markdownregistry.com/api/v1/blob/6c319d68bd8a933a36ba4266f679fc11b08ab0e666d29c41d1e3cfb41af53d91
Your agent does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.