Analyze a trading strategy's backtest results and provide improvement suggestions. Use when asked to analyze, review, or improve a strategy.
Analyze the current strategy's backtest results and provide actionable improvement suggestions.
List available strategies:
ls ~/.tradery/strategies/
If user specified a strategy, use that. Otherwise, find the most recently modified:
ls -t ~/.tradery/strategies/*/summary.json | head -1
Read the summary.json for quick overview:
~/.tradery/strategies/{strategyId}/summary.json
Key fields to examine:
metrics - Overall performance (winRate, sharpeRatio, maxDrawdownPercent, etc.)analysis.byPhase - Performance breakdown by market phaseanalysis.byHour - Performance by hour of day (UTC)analysis.byDayOfWeek - Performance by day of weekanalysis.suggestions - Pre-computed suggestionsBrowse trade filenames for patterns:
ls ~/.tradery/strategies/{strategyId}/trades/
Count outcomes:
ls ~/.tradery/strategies/{strategyId}/trades/ | grep -c "_WIN_"
ls ~/.tradery/strategies/{strategyId}/trades/ | grep -c "_LOSS_"
ls ~/.tradery/strategies/{strategyId}/trades/ | grep -c "_REJECTED"
Read 3-5 of the biggest losses to understand failure modes:
ls ~/.tradery/strategies/{strategyId}/trades/*_LOSS_* | sort -t_ -k4 -r | head -5
Then read those specific trade files to understand:
Read the strategy to understand current settings:
~/.tradery/strategies/{strategyId}/strategy.json
Structure your response as:
Performance Summary
What's Working
What Needs Improvement
Specific Recommendations For each recommendation, provide:
Example:
Recommendation: Add "uptrend" as a required phase
Why: Trades during uptrend have 72% win rate vs 55% overall (based on 28 trades)
Edit strategy.json:
{
"phaseSettings": {
"requiredPhaseIds": ["uptrend"], // Add this
...
}
}
Always end with a summary table:
| Metric | Current | Potential |
|---|---|---|
| Win Rate | 55% | ~65% (if filtering by uptrend) |
| Sharpe | 1.2 | ~1.5 |
And ask: "Would you like me to apply any of these changes?"