运行实时 A/B 测试¶
本指南向您展示如何在不同账户上使用不同设置部署同一 cBot,让它们并行运行,然后要求 AI 代理比较结果并告诉您哪个设置获胜。
1. 选择要测试的内容 ¶
决定您要比较什么。 您可以测试不同的参数值、不同的指标、不同的交易品种或任何组合。
Show me the metadata for C:\test\moving-average-bot.algo so I
know what parameters I can change.
对于此示例,假设 cBot 有一个名为 IndicatorType 的参数,它接受 SMA 和 EMA 等值。
2. 启动变体 A ¶
在一个账户上启动第一个配置。
Start C:\test\moving-average-bot.algo on account 1234567, EURUSD H1
with IndicatorType set to SMA and Periods set to 20.
3. 启动变体 B ¶
在另一个账户上启动第二个配置。
Start C:\test\moving-average-bot.algo on account 7654321, EURUSD H1
with IndicatorType set to EMA and Periods set to 20.
两个 cBot 现在在同一交易品种上同时运行,但使用不同的指标设置,每个都在自己的账户上,因此结果完全独立。
4. 让它们运行 ¶
告诉代理测试应持续多长时间,并要求它稍后检查。
Let both bots run for 5 hours, then tell me which one was more
profitable.
代理等待指定的时间段,然后从两个实例读取日志和交易结果。
5. 比较结果 ¶
测试期结束后,请求详细比较。
Compare both runs side by side: number of trades, win rate, total
profit, maximum drawdown and average trade duration. Which
configuration performed better overall?
代理从两个账户中提取数据并呈现结构化比较,以便您准确了解每个变体的成功或困难之处。
6. 深入挖掘 ¶
如果结果接近,请要求代理寻找更细微的差异。
Did one configuration handle volatile periods better than the other?
Were there times when one was profitable and the other was losing?
If I had run both configurations for a full trading day instead of
5 hours, which one would you expect to come out ahead and why?
7. 停止失败的变体 ¶
一旦确定了明确的赢家,就关闭表现不佳的配置。
Stop the cBot running on account 7654321.
8. 扩展赢家 ¶
更广泛地部署获胜配置。
Now start the same cBot with the SMA configuration on account
7654321 as well, on GBPUSD H1 with the same parameters.
注意
在实盘账户上进行 A/B 测试使用真实市场条件,这使得比较比单独回测更可靠。 但是,两个账户都在执行真实交易——如果您想在没有财务风险的情况下进行测试,请始终使用模拟账户。