Download MetaTrader 5
To add comments, please log in or register
Have you found a good programmer? Make a targeted order!
felipeforexmjmq
5
felipeforexmjmq 2016.05.13 19:06 

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()
{   
   // GETTING TICK INFO
   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()
{
    MarketBookAdd(SYMBOL_1);
    MarketBookAdd(SYMBOL_2);

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

Fernando Carreiro
1601
Fernando Carreiro 2016.05.13 19:24  

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