2022年使用MT5从脚本运行测试



我一直在开发一个bash脚本,以便在windows上与MSYS一起运行,该脚本应该能够启动测试并在html报告中获得报告。但我所能做的就是在没有任何配置的情况下启动终端。

使用类似于的配置文件

; start strategy tester
TestExpert=<full path to .ex5 file>
TestExpertParameters=<full path to .set file>
TestSymbol=WDOV22
TestPeriod=H1
TestModel=2
TestSpread=0
TestOptimization=false
TestDateEnable=true
TestFromDate=2022.01.01
TestToDate=2022.06.06
TestReport=<full path to non existing file without extension>
TestReplaceReport=true
TestShutdownTerminal=true

如果我转到PowerShell窗口并运行:

.terminal64.exe "<fullpath to config file>"

或:

.terminal64.exe /config:"<fullpath to config file>"

或:

.terminal64.exe /portable /config:"<fullpath to config file>"

以及其他变体,所发生的只是MetaTrader5打开,没有执行测试,测试仪上的配置没有变化,等等

问题:

1-有人做过类似的事吗?这个论坛上的所有答案似乎都过时了,文档也很混乱。

2-.ini文件是否需要一些特定的编码?它需要ASCII还是UTF-8就足够了?

3-便携式标志还能工作吗?有必要吗?

4-我做错了什么吗?MT5不是在某种程度上暗示了我可能做错了什么吗?

5-杂志说云服务器关闭了,但我还是在尝试在本地进行测试。

您是否检查了日志/日志?作为一个ini文件,我使用了一个由MT5生成的现有文件,并自己进行了自定义。

我只是把我的批量设置放在一个回购中,你可以在我的github帐户中找到它:FuscaSoftware MT5BatchSetup我希望它能帮助你。

通常报告都是excel,所以我不确定是否存在,但为了指导,这是我的bat文件,你可以根据需要或任何你想做的事情修改它。

然而,它是非常先进的,您只需要每个想要测试的EA一个ini文件,bat文件代码使用powershell修改对,并在启动MT5测试仪之前通过powershell调整报告名称。这对我来说是理想的,因为我想跑很多对,而不是一对又一对,这可能很有用,所以它就在这里

对于ini文件,以下链接非常有用。在此处输入链接描述

@echo off
echo Startscript to start MT5 optimization/backtester automated.
set "iniFile=D:MT5Tester2YOUR EA NAME HERE.ini"
:: Define the list of currency pairs to loop over
set "pairs=AUDUSD EURJPY EURUSD GBPJPY GBPUSD NZDUSD USDCAD USDCHF USDJPY"
:: Loop over each currency pair
for %%p in (%pairs%) do (

:: Set the currency pair in the ini file
powershell -Command "(Get-Content "%iniFile%") -replace 'Symbol=.*', 'Symbol=%%p' | Set-Content "%iniFile%""

:: Set the report path in the ini file
powershell -Command "(Get-Content "%iniFile%") -replace 'Report=.*', 'Report=reportsYOUR EA NAME HERE %%p' | Set-Content "%iniFile%""

:: Run the tests 5 times for the current currency pair
for /L %%i in (1,1,5) do (
echo Pair: %%p, Iteration: %%i
echo %date% - %time%
D:MT5Tester2terminal64.exe /portable /config:"%iniFile%"
echo %date% - %time%
)
)
echo "Finished!"
PAUSE

相关内容

最新更新