How to export data in MT5 to excel for multiple currency pairs?


So I have an EA that works properly and at the OnDeinit() function it exports certain backtesting data from the strategy tester into an excel file.

Such as total trades, winning trades, drawdown etc.

When running the built in strategy tester on individual currency pairs like AUDJPY and it works as it should with a cvs file with the relevent data being created.

However I am trying to do this for multiple currency pairs at once. So I have tried using multiple currency pair simulation built into mt5.

So if im not wrong the Multi currency tester is running the ea on each pair one after the other and showing the results with the data in the Optimization results tab.

But the problem ive hit is that when I run the multiple currency tester it it only creates data for some of the pairs and not all. Changing setting like the inputs or modeling (every tick etc) changes which pairs data I get.

So if im backtesting 8 pairs in the market watch, the excel for one model(every tick, 1 min OHLC)  would have the data be only 2 of the 8 pairs, or 3 of the 8 pairs, or none at all sometimes. So the excel doesnt have data for all 8 pairs, just some of them or none at all.

From what I see, is the multicurrency tester running on historical results, so it's not running certain pairs more then once(just calling the trades data from history) thus not running the writeFile() method in the  OnDeinit() as the Ea is not run on that currency pair?, ( my code runs fine when backtesting one by one on individual pairs )

If there is any solutions to creating excel on multiple currency pairs at once, any help would be appreciated.

This is the basic code i'm using to write the data to excel file, which is run on OnDeinit(),

It creates one excel file which each row is one currency pairs data, so its appending to the file.(or it should at least im im not mistaken)


int testHandle = FileOpen("dataTest.csv",FILE_READ|FILE_WRITE|FILE_CSV|FILE_ANSI,',');

FileSeek( testHandle  ,0,SEEK_END);

FileWrite( testHandle  ,"Currency:",Symbol(),TesterStatistics(STAT_PROFIT) ......(this line has just more testerStatiscics data thats exported to excel)

FileClose( testHandle  );

The Fundamentals of Testing in MetaTrader 5
The Fundamentals of Testing in MetaTrader 5
What are the differences between the three modes of testing in MetaTrader 5, and what should be particularly looked for? How does the testing of an EA, trading simultaneously on multiple instruments, take place? When and how are the indicator values calculated during testing, and how are the events handled? How to synchronize the bars from different instruments during testing in an "open prices only" mode? This article aims to provide answers to these and many other questions.

Do not double post!

I have deleted your duplicate topic.

Keith Watford #:

Do not double post!

I have deleted your duplicate topic.

Oh my bad, I posted originally in the wrong forum, I thought I deleted the original one first.