Recording highest and lowest values of EMA for last 610 candles

 

Hello all,

I'm trying to record the values of EMA indicator for the last 610 candles.

I've only suceeded to 'Comment' the highest value, failing do the same for lowest value.

And I don't understand where I'm failing.

I've attached my code.

Discover new MetaTrader 5 opportunities with MQL5 community and services
Discover new MetaTrader 5 opportunities with MQL5 community and services
  • www.mql5.com
Ask questions on technical analysis, discuss trading systems and improve your MQL5 programming skills to develop your own trading strategies. Communicate and share your experience with traders from anywhere in the world, answer questions and help beginners — MQL5.community is developing along with you. Forecast and levels for USD/CNH USD/CNH...
Files:
 
   if(     MaxValue>MinValue) Comment("\n", "Highest value = ",MaxValue,"\n");
   else if(MaxValue<MinValue) Comment("\n","\n", "Lowest value = ",MinValue,"\n");
  1. Max > min: you print out max and are done.
  2. Max = min: you then test for Max < Min which is false and print nothing.
  3. Max < min: is impossible and you print nothing.
  4. LiorB: I've only suceeded to 'Comment' the highest value, failing do the same for lowest value.
    Why are you comparing values, when all you want is to Comment both?
 
William Roeder:
  1. Max > min: you print out max and are done.
  2. Max = min: you then test for Max < Min which is false and print nothing.
  3. Max < min: is impossible and you print nothing.
  4. Why are you comparing values, when all you want is to Comment both?

If I do that :

if(MaxValue>MinValue)
     {
      Comment("\n", "Highest value = ",MaxValue,"\n", "Lowest value = ",MinValue,"\n");
     }

The lowest value is always 0

So, I can't figure it out.

What is wrong in code???

 
LiorB:

If I do that :

The lowest value is always 0

So, I can't figure it out.

What is wrong in code???

I have test it and working correct.

Reason: