为 cBot 找到最佳参数¶
本指南向您展示如何让 AI 代理使用不同的参数组合运行大量回测,分析所有结果,并告诉您哪种配置表现最佳。
1. 了解 cBot ¶
首先询问代理 cBot 公开了哪些参数,以便您了解正在使用的内容。
Show me the metadata for C:\test\RSI_cBot.algo. List every
parameter, its type, default value and any constraints.
查看输出。 确定要优化的参数——例如,Periods、Quantity 和 StopLoss。
2. 运行快速基准 ¶
在运行多次回测之前,确定 cBot 在默认设置下的表现。
Backtest C:\test\RSI_cBot.algo on EURUSD H1, account 1234567 for
the last 12 months. Give me the results.
代理运行回测并返回关键指标:盈利净值、总交易数、胜率、盈利因子和最大回撤。 这些是您试图超越的数字。
3. 让 AI 运行大量回测 ¶
现在要求代理系统地测试许多组合并找到最佳组合。
Run 50 backtests of C:\test\RSI_cBot.algo on EURUSD H1, account
1234567 over the last 6 months using different combinations of
Periods (between 5 and 50) and StopLoss (between 10 and 100).
Analyse all the results and tell me which combination delivered
the most profit.
代理在运行中改变参数值,收集结果,并呈现排名摘要。 您无需自己设计每个测试即可获得最佳配置。
4. 针对特定指标进行优化 ¶
盈利不是唯一重要的事情。 您可以要求代理优化以降低风险。
What parameters should I run the cBot on for the lowest possible
drawdown?
代理分析已收集的回测数据(或在需要时运行新测试)并推荐一种将回撤最小化的配置,即使它牺牲了一些盈利。
5. 验证建议 ¶
在更长的时间窗口上确认配置之前,切勿部署配置。
Run a backtest over the last 2 years using those parameters to
confirm your hypothesis.
代理在更长的时间段内使用推荐的参数运行回测。 如果结果保持不变,您就有了一个经过验证的配置。 如果它们退化,则优化可能过度拟合了较短的窗口。
6. 在其他品种上测试 ¶
真正稳健的配置应该适用于多个交易品种。
Now backtest the same cBot with those parameters on GBPUSD, USDJPY
and XAUUSD over the last 2 years. Compare the results across all
four symbols.
代理运行三次回测并呈现比较表。 寻找一致的盈利能力,而不是一个品种承载所有收益。
7. 部署赢家 ¶
一旦您对结果有信心,就使用优化的参数启动 cBot。
Run C:\test\RSI_cBot.algo on account 1234567, EURUSD H1 with
Periods set to 22 and StopLoss set to 45.
提示
告诉代理在大量回测阶段将历史数据缓存在特定目录中。 这可以防止它在每次运行时重新下载价格数据,并使该过程显著加快。
Cache all price data in C:\test\price-cache for these backtests.