Download MetaTrader 5

Examples: How to Write Fast Non-Redrawing ZigZags

To add comments, please log in or register
Join MQL5 Cloud Network. Start earning money!
MetaQuotes Software Corp.
MetaQuotes Software Corp. 2008.09.12 10:51 

New article How to Write Fast Non-Redrawing ZigZags has been published:

A rather universal approach to writing indicators of the ZigZag type is proposed. The method includes a significant part of ZigZags already described and allows you to create new ones relatively easily.

First of all, let's try to formulate the general approach to writing an indicator. Thus:

- Function start() of any indicator (as well as any EA) represents a callback function, i.e., a function to be called to process a specific event. Namely, to process a tick.

- The object of writing an indicator is, as a rule, the calculation of one or several market characteristics. Along with the ancillary quantities necessary for calculations, they form a set of key variables of the given indicator. Let's defined the state of the indicator as a set of the values of those key variables at a specific time. Basing on this definition, we can state the following:

  • Calculating the new values of variables at a new tick, function start() calculates the new state of the indicator.
  • Thus, in fact, function start() is an operator that transfers the indicator from one state into another.

- In these terms, the process of writing an indicator reduces itself to determining a set of quantities describing its state (state variables) and to writing an operator that would transfer the indicator into a new state at the arrival of a new tick. Initialization of state variables becomes an essential part of the indicator algorithm. We will show how all this can be done at the example of ZigZags of a certain type.

Author: Candid

MQL4 Comments
MQL4 Comments 2008.09.13 22:12  
Dear Candid,

Can you please write comments in HZZ.mq4 and ZZTemplate.mq4 in english.

Thanks in advance.


MQL4 Comments
MQL4 Comments 2009.06.24 10:02  
Thanks a lot for this one, it realy helped me!
MQL4 Comments
MQL4 Comments 2009.10.08 03:56  
heelo candid,Thanks a million for this great article.please i would like to know how i can add codes to get the coordinates of a predefined number of preceding peaks, using arrays like you suggested.i need to get the values of the last three peaks.Thanks a million
Ankit Jain
Ankit Jain 2012.11.01 11:08  
best timeframe for zig zag to use..reply??
Jean Marc VENET
Jean Marc VENET 2012.11.22 18:21  

Hi guys,

I can translate from 'ru' to 'en' the comments, if needed, give me  about 2 or 3 hours. Interested ?

forextime8 2014.08.31 08:19  

Where can i download HZZ in mql5 ?

To add comments, please log in or register