Download MetaTrader 5

Reading multiple pairs on single chart

To add comments, please log in or register
tigersoft
63
tigersoft  

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
63
tigersoft  
For single pair it works. But not for multiple pairs.
Keith Watford
Moderator
10561
Keith Watford  

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
63
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. 

honest_knave
Moderator
2334
honest_knave  
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
63
tigersoft  

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
2334
honest_knave  

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

tigersoft
63
tigersoft  
Ok. Thanks
To add comments, please log in or register