imported-backtest
Handles importing MT5 Strategy Tester HTML reports uploaded by users as first-class backtest results. Covers parsing via the canonical ReportParser, equity reconstruction from broker or Darwinex fallback price data, broker server resolution, and integrating imported results into comparison and analysis pipelines. Use for: uploading .htm reports from external MT5 sessions; reconstructing equity curves when no live terminal is available; making imported tests indistinguishable from native runs. Trigger on: "import backtest", "upload HTML report", "imported test", "import report".
Unsigned, install at your own risk
UnverifiedThis skill has no cryptographic signature attached. We can't verify the contents match what the publisher intended.
Install this skill
No account required. Pick your tool, or use the command that detects it for you.
Run in your terminal. It detects your AI tool.
npx @skills-hub-ai/cli install metatrader-imported-backtestManual setup by platform
Claude Code
~/.claude/skills/metatrader-imported-backtest/SKILL.md
Instructions
Imported Backtests
Purpose
Users can run MT5 Strategy Tester on their own terminal and upload the
.htm report file. This skill handles the full pipeline: receive the
file, parse it into the same TestResult structure used by native runs,
reconstruct the equity curve from available price data (broker terminal or
Darwinex fallback), and surface the result in the comparison and analysis
UI with an "Imported" badge.
When to use / When NOT to use
Use when:
- Implementing or debugging the
POST /api/tests/import-reportroute - Adding broker/server resolution for a new price-data source
- Fixing equity reconstruction for imported reports
- Building the import dialog UI or result badges
Do NOT use for:
- Native backtest execution (use
backtest-analysisskill) - Interpreting backtest metrics after import (use
analyticsskill) - Generic file upload handling
Core guidance
Import pipeline
- Receive — multipart POST with
.htmfile, user auth, optional
broker/server override - Persist — save raw HTML to
{data-dir}/reports/{uuid}.htm - Parse — call canonical
ReportParser.parseTestReport()(same code
native runs use) → producesTestResultwith 80+ metrics - Resolve broker — map
report.loginServerto a price-data context
(configured MT5 account, Darwinex metadata, or none) - Reconstruct equity — run
reconstructEquity()with the resolved
context → save equity history to{data-dir}/equity-history/{testId}.json - Persist — store
TestRecord+TestResultmarkedsource: 'imported'
Broker resolution (3-way)
report.loginServer → match config.accounts[*][*].server
├─ YES → ping({ broker, account })
│ ├─ success → use broker price data
│ └─ failure → Darwinex fallback
└─ NO → Darwinex fallback
├─ has symbol data → equity reconstructed
└─ no data → equityStatus = 'unavailable'
The user can override auto-detection via the import dialog.
Data model
TestResult gains optional fields to track import provenance:
source:'native' | 'imported'importedAt: ISO timestamporiginalFileName: uploaded filenameequityStatus:'ok' | 'approximate' | 'unavailable'equityUnavailableReason,equityMissingSymbols: diagnostic info
These are nullable columns in PostgreSQL; existing rows default to
source='native'.
Code patterns
Import route skeleton
// POST /api/tests/import-report
export async function POST(req: Request) {
const form = await req.formData()
const file = form.get('file') as File
// validate: .htm, max 50MB
// persist raw HTML to {data-dir}/reports/{uuid}.htm
// parse via ReportParser.parseTestReport(filepath)
// resolve broker context from report.loginServer
// reconstruct equity
// save TestRecord + TestResult
// return 201 with test ID
}
Equity reconstruction with graceful failure
function reconstructEquityWithStatus(
deals: Deal[],
context: PriceDataContext
): EquityReconstructionResult {
try {
const result = reconstructEquity(deals, context)
if (!result) {
return {
points: [],
unavailableReason: 'reconstructor returned null',
missingSymbols: []
}
}
return result
} catch (e) {
return {
points: [],
unavailableReason: e.message,
missingSymbols: []
}
}
}
Common mistakes
- Treating missing equity as fatal — imported reports may lack price
data. TheequityStatusfield and banner handle this gracefully. Never
reject an import because equity cannot be reconstructed. - Leaving null returns —
reconstructEquity()returnsnullon
failure. Wrap it to always return a result with diagnostic fields. - Skipping HTML sandboxing — user-uploaded HTML is untrusted. Always
serve via sandboxed iframe with strict CSP or strip scripts on ingest. - Hardcoding server → broker mappings — read from
config.yamland
ping to verify connectivity; server names change per deployment.
References
| File | Content |
|---|---|
| (none yet) |
Security
Reviews (0)
Related skills
Browse all →More from MetaTrader Skills
View source →More Build skills
Browse category →Frequently asked questions about imported-backtest
What does the imported-backtest skill do?
Handles importing MT5 Strategy Tester HTML reports uploaded by users as first-class backtest results. Covers parsing via the canonical ReportParser, equity reconstruction from broker or Darwinex fallback price data, broker server resolution, and integrating imported results into comparison and analysis pipelines. Use for: uploading .htm reports from external MT5 sessions; reconstructing equity curves when no live terminal is available; making imported tests indistinguishable from native runs. Trigger on: "import backtest", "upload HTML report", "imported test", "import report". It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the imported-backtest skill?
Run `npx @skills-hub-ai/cli install metatrader-imported-backtest` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/metatrader-imported-backtest/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does imported-backtest work with?
imported-backtest runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the imported-backtest skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use imported-backtest after installing it?
In Claude Code, type `/metatrader-imported-backtest` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the imported-backtest skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.