Download MetaTrader 5

Reading multiple pairs on single chart

To add comments, please log in or register
Use MQL5 Cloud Network. Test robots at a super speed!
tigersoft
62
tigersoft 2016.02.05 21:21 

Hello,

 

I am trying to read values for multiple pairs on single chart. On single chart indicator works. But when i am trying to read from more pairs on same chart so it is going wild. Do you have any idea what to do to get it to work?

   double EURH1=iHigh("EURUSD",PERIOD_CURRENT,0);
   double EURL1=iLow("EURUSD",PERIOD_CURRENT,0);
   double EURC1=iClose("EURUSD",PERIOD_CURRENT,0);
   if(EURC1 >= EURH1 ){ Alert("EURUSDHighest"); };
   if(EURC1 <= EURL1) { Alert("EURUSDLowest"); };
   
   double EURH2=iHigh("EURGBP",PERIOD_CURRENT,0);
   double EURL2=iLow("EURGBP",PERIOD_CURRENT,0);
   double EURC2=iClose("EURGBP",PERIOD_CURRENT,0);
   if(EURC2 >= EURH2 ){ Alert("EURGBPHighest"); };
   if(EURC2 <= EURL2) { Alert("EURGBPLowest"); };
   
   double EURH3=iHigh("EURJPY",PERIOD_CURRENT,0);
   double EURL3=iLow("EURJPY",PERIOD_CURRENT,0);
   double EURC3=iClose("EURJPY",PERIOD_CURRENT,0);
   if(EURC3 >= EURH3 ){ Alert("EURJPYHighest"); };
   if(EURC3 <= EURL3) { Alert("EURJPYLowest"); };

 

Thanks 

tigersoft
62
tigersoft 2016.02.05 21:22  
For single pair it works. But not for multiple pairs.
Keith Watford
Moderator
9619
Keith Watford 2016.02.05 22:58  

What does "going wild" mean?

Explain what it does do that you are not expecting.

Explain what it doesn't do that you are expecting. 
tigersoft
62
tigersoft 2016.02.06 09:40  

It is not showing correct results. It is showing High and Low results at the same.

Means reading iHigh and iLow results is the same value. 

honest_knave
Moderator
2200
honest_knave 2016.02.06 11:43  
tigersoft:

It is not showing correct results. It is showing High and Low results at the same.

Means reading iHigh and iLow results is the same value. 

None of your Alert statements you posted are checking for equality... so if you are basing this on not getting any alerts there may be another reason in your code.

Alternatively, you may not have data loaded for those pairs yet. Therefore both values are 0.

 

tigersoft
62
tigersoft 2016.02.06 18:32  

I am getting Alerts. But it is not of live values. It is giving Alerts example. EURUSDHighest and EURUSDLowest at same time.

honest_knave
Moderator
2200
honest_knave 2016.02.06 18:52  

Then I suggest you add the values into your alert statement so you can see what is going on

tigersoft
62
tigersoft 2016.02.06 21:50  
Ok. Thanks
To add comments, please log in or register