Hello,
Thank you
You can try this.
import subprocess def start_mt5_backtest(expert, symbol, timeframe, start_date, end_date): # Path to MetaTrader 5 terminal executable mt5_terminal_path = "C:/Path/To/Your/MetaTrader5/terminal64.exe" # Update this with your actual path # Command line parameters for backtesting command_line_params = [ mt5_terminal_path, "/config:Default", "/expert:\"{}\"".format(expert), "/symbol:\"{}\"".format(symbol), "/period:{}".format(timeframe), "/from:\"{}\"".format(start_date), "/to:\"{}\"".format(end_date), "/skipflp", "/skipwnd" ] # Start the MetaTrader 5 terminal process with the specified parameters subprocess.Popen(" ".join(command_line_params), shell=True) if __name__ == "__main__": # Example parameters for backtesting expert_file = "YourExpert.ex5" # Update this with the path to your expert advisor file symbol = "EURUSD" timeframe = 1440 # Daily timeframe start_date = "2020.01.01" end_date = "2021.01.01" # Start the backtest start_mt5_backtest(expert_file, symbol, timeframe, start_date, end_date)
I hope you manage. You can always change this or play around with the idea.
Replace "C:/Path/To/Your/MetaTrader5/terminal64.exe" with the actual path to your MetaTrader 5 terminal executable. Also, update "YourExpert.ex5" with the path to your expert advisor file.
To execute this script, save it as a .py file, navigate to its directory in the command line, and run python script_name.py . This will start the backtest process in MetaTrader 5 with the specified parameters.
You can try this.
I hope you manage. You can always change this or play around with the idea.
Replace "C:/Path/To/Your/MetaTrader5/terminal64.exe" with the actual path to your MetaTrader 5 terminal executable. Also, update "YourExpert.ex5" with the path to your expert advisor file.
To execute this script, save it as a .py file, navigate to its directory in the command line, and run python script_name.py . This will start the backtest process in MetaTrader 5 with the specified parameters.
Hello Nardus,
Thank you a lot for your help!
This is a good start, since I don't have experience in coding.
There are other parameters like Delays which I like 30ms, Modelling which I like "1 minute OHLC", "profit in pips for faster calculations", Deposit: $100, leverage 1:500, Optimization: "Fast genetic based algorithm" with "Custom max" and also the parameters of the EA.
Can you help with this? I'm more than happy to create a Freelance job if it's an option for you with payment. Basically I like that "Start" to be automatically and not waiting every 2 hours and click again to see more and more backtesting.
I think probably there are more people with this situation.
Thank you a lot!
you could watch this video to do it without learning to code,
https://www.youtube.com/watch?v=aUiLM3cang8&t=2s
This is an example how to do it automatically
"D:\MT5 - Eightcap\Eightcap - MT5\terminal64.exe" /config:"D:\StrategyName_AUDCAD.ini" "D:\MT5 - Eightcap\Eightcap - MT5\terminal64.exe" /config:"D:\StrategyName_AUDCHF.ini" "D:\MT5 - Eightcap\Eightcap - MT5\terminal64.exe" /config:"D:\StrategyName_AUDJPY.ini" "D:\MT5 - Eightcap\Eightcap - MT5\terminal64.exe" /config:"D:\StrategyName_AUDNZD.ini" "D:\MT5 - Eightcap\Eightcap - MT5\terminal64.exe" /config:"D:\StrategyName_AUDUSD.ini" "D:\MT5 - Eightcap\Eightcap - MT5\terminal64.exe" /config:"D:\StrategyName_CADCHF.ini" ...
you can run it using task scheduler if you want to
- 2023.02.23
- www.youtube.com
you could watch this video to do it without learning to code,
https://www.youtube.com/watch?v=aUiLM3cang8&t=2s
This is an example how to do it automatically
you can run it using task scheduler if you want to
Hello Luandre,
I only can say thank you a lot!!! It is working and this is what I was looking for. Simply amazing. I hope I can help some day too. Thank you a lot :-)
This way an agent could be able to refine code by running Strategy Tester activities, draw conclusions from output and apply changes that eventually
improve on the tester results.
Basic problem has been Strategy Tester is UI based and agents can so far only use command line as actions to run.
By implementing command line syntax that enable running commonly used Strategy Tester operations it can
help being able to let an agent test/iterate and refine strategies and thus provide its user with a better code result.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Thank you