Expert History Export - MetaTrader 5 Library | MT5 EA Download - MetaTrader 5 Resources
Added the ability to automatically export trading history after running an Expert Advisor in the Strategy Tester.
File saved in shared terminal folder public/files or in the terminal folder MQL5/Documents.
The file name is automatically generated or set manually when calling the method. exit()
History files can be used to simulate the same trading sequence on another trading server using the EA Simple History Receiver .
1. Instantiate the object in the global scope:
CExpertHistory ExpertHistory();
2. Add to function call OnTester() method call exit() :
doubleOnTester(void) {
...
ExpertHistory.Export();
...
1. Instantiate the object in the global scope:
String expert name = "SomeExpert";
String expert version = "1.00"; // Not required
CExpertHistory Expert history record (expert name, expert version);
2. Add functions OnInit() Any parameter name and value pair:
input doubleSL = 500;
Enter double TP=1000;
...
ExpertHistory.AddParam("symbol", Symbol());
ExpertHistory.AddParam("TP", TP);
ExpertHistory.AddParam("SL", SL);
...
3. Add to function call OnTester() method call exit() :
doubleOnTester(void) {
...
if(!MQLInfoInteger(MQL_OPTIMIZATION)) { // If you only want to save history within a single tester run
ExpertHistory.Export();
}
...
in method exit() There are options:
Invalid export (
string export FileName = "", // The name of the file to be exported. If it is empty, it is generated based on the exportFileNameFormat parameter.
ENUM_HISTORY_EXPORT_FORMAT exportFormat = HEF_INI_FULL, // Export format. By default, in addition to transactions, the file // records account parameters, test period, maximum. Retracement etc.
ENUM_HISTORY_FILENAME_FORMAT exportFileNameFormat = HFF_FULL, // File name format. By default, the file name includes server name, test period, and maximum time. Retracement etc.
int commonFlag=FILE_COMMON // Save the file to the shared terminal folder. If equal to 0, save to a non-shared folder.
);
Attachment download
📎 experthistoryexample.mq5 (2.87 KB)
📎 experthistory.mqh (38.82 KB)
Source: MQL5 #38938
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •