Test Trade Saver Script
- Utilitys
- Semen Racheev
- Version: 1.1
- Aktualisiert: 28 Oktober 2024
Program - Script
Implements the saving of executed operations from the cache file of a tested trading system into a file as lines of text. This is necessary for further integration with other products from Semyon Racheev, such as a capital management service and others.
The script is executed for one tested trading system (data is taken from the cache file after testing in the *.tst tester).
To use the script, you need to specify the path to the *.tst cache file after testing in the tester. The files are located in "<Data folder>/Tester/cache"
Since MQL5 programs can ONLY work with files within the "<Data folder>/MQL5/Files" directory, you need to first copy/move the test result (the *.tst file) from the "<Data folder>/Tester/cache" directory.
or (Optional)
For easier handling of *.tst files, you can create a link in the "<Data folder>/MQL5/Files" directory to the "<Data folder>/Tester/cache" directory, so you can work directly with testing cache files without prior copying. To do this:
- Open the "<Data folder>/MQL5/Files" directory and copy the full path.
- Open the command prompt as Administrator (Start -> cmd -> run as Administrator).
- In the command prompt, enter and execute "cd <path from step 1>"
- In the command prompt, enter and execute "mklink /D 'cache' '....\Tester\cache'"
As a result, a link to the "<Data folder>/Tester/cache" directory will appear in the "<Data folder>/MQL5/Files" directory, and you can use the tester cache directory with *.tst files within MQL5 programs.
Algorithm:
- After running the script, you need to select the *.tst file that you previously copied from "<Data folder>/Tester/cache" to the "<Data folder>/MQL5/Files" directory or go to the link pointing to the "<Data folder>/Tester/cache" directory.
- If the *.tst file is found, the script will save the list of positions from the test into a file named <CUSTOM_MAGIC_NUMBER>.csv in the directory specified in the script parameters.
File name: "<CUSTOM_MAGIC_NUMBER>.csv"
Each line of the file represents a closed position in the format "<magicNumber>,<positionCloseTime>,<positionVolume>,<positionProfit>"
Thus, in the directory specified in the script parameters, a file is created with the results of closed positions from the backtest results for more accurate capital management calculations or other analytical products from Semyon Racheev.
The script uses a library by fxsaber
https://www.mql5.com/en/code/27611