Download MetaTrader 5

Multiple trades open on different symbols in Strategy Tester ?

To add comments, please log in or register
Hundreds of articles will help you to create a trading robot. Come and read them!
Florent
183
Florent 2015.05.16 23:24 

Hello,

I'm using Strategy Tester with a multiple currency EA but I can't figure out how it works in detail. There is this article that introduce Multiple Currency EA but it doesn't go into details.

Ok there is an option to say "Take all symbols selected in MarketWatch" but from what I see it doesn't really simulate multi trade over multiple currencies condition.

The EA open multiple position on different symbol at the same time, it reads signals from an external file (csv format). In this example there is 2 position open at a time :

2015.03.05,EURUSD,1.11544,-1
2015.03.05,USDCAD,1.24928,-1
2015.03.09,USDCAD,1.25556,1
2015.03.09,EURUSD,1.09212,-1
2015.03.23,EURUSD,1.0785,1
2015.03.23,USDCAD,1.25923,-1
2015.03.31,EURUSD,1.08657,1
2015.03.31,USDCAD,1.26318,1
2015.04.02,USDCAD,1.2671,1
2015.04.02,EURUSD,1.07661,-1

My impression is that tester in MT5 cannot handle such EA. Do I have a chance to have historical results ?

Subscribe
Subscribe
  • metatrader5.blogspot.de
In Metatrader 5 Strategy Tester you can test an Expert Advisor using different currencies, but you can also automatically test a multi-currency EA without the need of switching the currencies as in MT4. To test a single currency EA using different currencies you must select the option "All Symbols Selected in Market Watch" in the optimization...
Alain Verleyen
Moderator
30736
Alain Verleyen 2015.05.17 02:46  

What is your problem actually ? You don't know which EA you are talking about.

There is no problem for MT5 to test a multi-currency EA, provided it is well coded.

Florent
183
Florent 2015.05.17 08:28  
Alain Verleyen:

What is your problem actually ? You don't know which EA you are talking about.

There is no problem for MT5 to test a multi-currency EA, provided it is well coded.

Hello Alain,

My EA reads signal from a file every day at 6:00PM. File looks like this:

2015.02.05,EURUSD,1.14221,1
2015.02.05,USDCAD,1.24963,1
2015.02.09,USDCAD,1.25206,1
2015.02.09,EURUSD,1.13446,-1
2015.02.11,EURUSD,1.13216,-1
2015.02.11,USDCAD,1.25058,-1

As you can see the file is updated when there is one or several new signals (1 and -1 give information on the order type : buy limit or sell limit). There are always two positions that remains open at a time on the two symbols : either long or short. It is also possible to have two position at a time but more than two symbols (see bellow).

So actually what my EA does (while reading the file) is quite simple :

1 - compare TimeCurrent() and TimeSignal (TimeSignal is the date of the signal in the file) and if it is the same day and the correct time (> 6:00 PM) then it checks if position in the file (i.e. symbol and direction) already exist in OrderTotal().

2 - If it doesn't exist then the position need to be open : first, if any, it starts closing open position on the same symbol (i.e. in the opposite direction), it calcuates lot size then open the position.

3 - In some case it can happen that two positions remains open at a time but the EA handle more than two symbols (see second example bellow). So a position may still remains open in OrderTotal() but doesn't exist anymore in the file for the current day (ex: USDJPY must be close the 2015.01.23). To close this position the EA compare each position in OrderTotal() with signals for the current day and if position doesn't exist in the file it close it.

2015.01.20,EURUSD,1.15804,-1
2015.01.20,USDJPY,117.458,-1
2015.01.23,USDCAD,1.22847,1
2015.01.23,EURUSD,1.15645,-1
2015.01.29,USDCAD,1.24439,1
2015.01.29,GBPUSD,1.51596,1

My problem is that when I select "Take all symbols selected in MarketWatch" the only thing I have is a new tab called "Optimization result" with gains and losses per symbol, but what I need is portfolio return over the backtest period. How can I do that ?

Thank you,

Florent

EDIT : in attach is the EA in MQL4 (I'm currently testing the EA with the code translated in MQL5).

Files:
Alain Verleyen
Moderator
30736
Alain Verleyen 2015.05.17 15:38  

"Take all symbols selected in MarketWatch" is not intended for multi-currency EA, it's purpose is to do an optimization on each symbols.

If your EA is multi-currency, just run it on any symbol and you will have the global results. 

If you need help for mql5, post mql5 code, mql4 is not useful as the trading system and the strategy tester don't work the same way.

Florent
183
Florent 2015.05.19 09:28  
Alain Verleyen:

"Take all symbols selected in MarketWatch" is not intended for multi-currency EA, it's purpose is to do an optimization on each symbols.

If your EA is multi-currency, just run it on any symbol and you will have the global results. 

If you need help for mql5, post mql5 code, mql4 is not useful as the trading system and the strategy tester don't work the same way.

Sorry Alain for not responding sooner and thanks for the confirmation. I will test again as soon as the EA is fixed.

Do you think there is a possibility to verify trades execution per symbols ? because Strategy Tester plots trades on chart for only one symbol (the one selected), and it looks the list of every order that was present in MT4 (with profits and losses) has been removed in MT5.

Alain Verleyen
Moderator
30736
Alain Verleyen 2015.05.21 13:56  
Florent:

Sorry Alain for not responding sooner and thanks for the confirmation. I will test again as soon as the EA is fixed.

Do you think there is a possibility to verify trades execution per symbols ? because Strategy Tester plots trades on chart for only one symbol (the one selected), and it looks the list of every order that was present in MT4 (with profits and losses) has been removed in MT5.

All informations are available about the trades in the results tab, just right-click and see the options.

To add comments, please log in or register