Get the ZigZag last High and Low

 

Greetings community


I would like to ask how can I get the last zigzag high and low and display on the screen using the comment().

Anyone can help please??


Best Regards

 
  1. Loop starting at the latest until you read a non-zero/non-EMPTY_VALUE value.
  2. Continue until you read the next value.
  3. Now you have a high and a low.
General rules and best pratices of the Forum.
General rules and best pratices of the Forum.
  • 2019.03.05
  • www.mql5.com
General rules, enforced by moderators : ‌...
 

Thank you for your reply William. It is possible to give a link to a example or code?


William Roeder:
  1. Loop starting at the latest until you read a non-zero/non-EMPTY_VALUE value.
  2. Continue until you read the next value.
  3. Now you have a high and a low.
 
OK 

HERE YOU ARE

Files:
 
Van Hoi Ha:
OK 

HERE YOU ARE

Thank you very much

 
CopyBuffer(ZigZagHandle,0,0,20,ZigZagBuffer);
      for(int x=0;x<20;x++)
        {
         if(ZigZagBuffer[x] != EMPTY_VALUE && ZigZagBuffer[x] != 0.0)
           {
            if(n<10)
              {
               p0 = NormalizeDouble(ZigZagBuffer[1],5);
              }
           }
        }  

So far I have reach this point I would like to get the last 3 non-zero values from the zigzag indicator buffer. Can Someone help me with it.

 
Alec Hilton Silva Couto:

So far I have reach this point I would like to get the last 3 non-zero values from the zigzag indicator buffer. Can Someone help me with it.

CopyBuffer(ZigZagHandle,0,0,20,ZigZagBuffer);
      for(int x=0;x<20;x++)
        {
         if(ZigZagBuffer[x] != EMPTY_VALUE && ZigZagBuffer[x] != 0.0)
           {
            if(n<10)
              {
               p0 = NormalizeDouble(ZigZagBuffer[1],5);
              }
           }
        }  

What is the variable n?  

What is the variable p0 and why, no matter what the loop does it is given the value of the 2nd element of ZigZagBuffer?


Please clarify if you are working with MQL4 or MQL5.

You have posted your topic in the MQL4 section.