Download MetaTrader 5

MQL4 MetaTrader (Strategy Tester) Oanda Simulation (cannot get tick of Multiple Symbols)

To add comments, please log in or register

My strategy uses multiple Symbols.

I use to simulate using SymbolInfoTick and getting the value of two or more symbols on MQL5 as in the code bellow:

It works gets the value of the two ticks.

When I do this on MQL5 it does work, it prints the value of SYMBOL_1 and SYMBOL_2:


input string SYMBOL_1 = "EURUSD";
input string SYMBOL_2 = "EURCHF"; 

void OnTick()
   MqlTick mtick1;
   SymbolInfoTick(SYMBOL_1, mtick1);
   printf("tick1: " + mtick1.ask1 + " " + mtick1.bid1);

   MqlTick mtick2;
   SymbolInfoTick(SYMBOL_2, mtick2);
   printf("tick2: " + mtick2.ask1 + " " + mtick2.bid1);  



But when I put this code on MQL4 on Oanda it does not work.

 Is this a restrition on Oanda Metatrader or it is a restrition on Metatrader itself?


OBS: This does work on live on Oanda Metatrader but does not work on Strategy Tester.


On MQL5 I use:

int OnInit()

To get the book info on another project. Do this influence something?
The MarketBookAdd doesn't exist on MQL4.

Fernando Carreiro
Fernando Carreiro  

MT4 Strategy Tester does not support multiple symbols/currencies. You can only test one symbol at a time.

MQL4 also does not have the "MarketBookAdd" function, and has many other differences too.

It might be best to read over the documentation and compare the two environments.

To add comments, please log in or register