monte-carlo
Run Monte Carlo simulations on a trading strategy to verify robustness.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Monte Carlo Simulation Skill
This skill runs a Monte Carlo simulation on a specific strategy using the scripts/monte_carlo_v1.py script. It validates the statistical robustness of a strategy by repeatedly sampling trade returns.
Usage
Invoke with: /monte-carlo <strategy_name> [limit] [iterations] [source]
Examples:
-
/monte-carlo scalp_1m_sweep_optimized(Default: 1000 bars, 1000 iterations, bitunix source) -
/monte-carlo scalp_1m_sweep_optimized 5000(5000 bars) -
/monte-carlo scalp_1m_sweep_optimized 2000 5000 mock(2000 bars, 5000 iters, mock data)
Parameters
-
strategy_name(required): Name of the strategy file inconfig/strategies/(without .json extension). -
limit(optional): Number of bars to backtest before simulation (Default: 1000). -
iterations(optional): Number of Monte Carlo iterations (Default: 1000). -
source(optional): Data source, 'bitunix' or 'mock' (Default: bitunix).
Prerequisites
- The script
scripts/monte_carlo_v1.pymust exist. - Python env must be set up.
Steps
// turbo-all
Step 1: Validate Script and Strategy
Ensure the tool and strategy exist.
$scriptPath = "scripts/monte_carlo_v1.py"
$stratPath = "config/strategies/$strategyName.json"
if (-not (Test-Path $scriptPath)) {
Write-Error "Monte Carlo script not found at $scriptPath"
exit 1
}
if (-not (Test-Path $stratPath)) {
Write-Error "Strategy not found at $stratPath"
exit 1
}
Write-Host "Ready to simulate $strategyName using $scriptPath"
Step 2: Run Simulation
Execute the python script.
- Defaults are applied if arguments are missing.
-
$limitdefaults to 1000 if not provided. -
$iterationsdefaults to 1000 if not provided. -
$sourcedefaults to "bitunix" if not provided.
# Set defaults if variables are null/empty
if (-not $limit) { $limit = 1000 }
if (-not $iterations) { $iterations = 1000 }
if (-not $source) { $source = "bitunix" }
Write-Host "Running Monte Carlo: Strategy=$strategyName, Source=$source, Limit=$limit, Iterations=$iterations"
$env:PYTHONPATH="src"
.\.venv\Scripts\python.exe scripts/monte_carlo_v1.py --strategy $strategyName --limit $limit --iterations $iterations --source $source
Step 3: Interpret Results
The script will output a table.
-
Pass Criteria:
-
Prob. of >20% DDshould be 0.00%. -
95% Max Drawdownshould be acceptable for your risk tolerance (e.g., < 20%). -
50% Percentile(Median) Equity should be > Starting Balance for a profitable strategy.
-
On Failure
- If
Prob. of >20% DDis high (> 0%), the strategy is too risky. - If Median Equity is < Start, the strategy has negative expectancy.
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!