Specification
I want to have a MT5 script/EA that runs a series of strategy tests on my EAs applying the definitions and restrictions settled in a csv file with all the inputs. Based on those definitions/restrictions each test finishes at the end date or is interrupted by the script/EA. Either way the results of each normally ended or script stoped test will be saved to a csv file with the defined output data.
Imagine I have a strategy to take an FTMO challenge every Monday of a given month and I want to have a script to test my EA for that. The strategy tests would have a defined start dates with an equity target1 (5%) and target2 (10%) to be achieved and a minimum equity defined (-10%). The output file will tell me the dates when the test was ended/stoped and the equity target values were achieved.
The attached example file shows a series of 6 different tests to be made and the output results expected.
Backtester_Inputs (CSV File):
The Backtester_Inputs csv file will have several lines. The ideia is for example to test the same EA on diferent start dates, or to test the same EA with different set files.
Expert: EA name
Set File: Set file to load
Asset: Asset to test
Timeframe: Timeframe to test
Start Date: Start date of the strategy test
End Date: End date of the strategy test
Equity Target1: Equity target , when the test reaches that target the date is saved to the backtester_output file; if value is blank there is no target 1.
Equity Target2: Maximum equity accepted, when the test reaches that target the test is stoped and values are saved in the backtester_output file; if value is blank there is no maximum target2 so the test will finish at the end date.
Min Equity: Minimum equity accepted, when the test reaches that value the test is stopped; if value is blank there is no minimum.
Latency: Perfect execution; 10ms; 20ms; 30ms; 50ms; 100ms
Modelling: Same options of the strategy tester
Deposit Amount:
Deposit Currency: Same options of the strategy tester
Leverage: Same options of the strategy tester (1:1 to 1:1000)
Backtester_Outputs (CSV File):
The backtester_outputs csv file will have a line with the following data for each test completed from start to end date or tests there were stopped by the script.
Expert: EA name
Set File: Set file used
Asset: Asset tested
Timeframe: Timeframe tested
Start Date: Start date of the test
Target1 Date: The date when the equity target 1 was achieved.
End Date: End date of the test; if the test was stopped by the script (target2 or minimum equity achieved) it saves the date of the last trade before the interruption of the test
Final Equity: the equity value at the end of the test or at the interruption date