This indicator was inspired by М & W Wave Patterns by A. Merrill. 5 extremums or 4 edges of ZigZag are enough to build M or W pattern at arbitrary offset in the history. The classical approach includes a table of predefined figures of ZigZag waves, which can transform into each other under special rules—so that next edge can be forecasted based on these rules. Unlike to this approach, the indicator analyses available history and builds statistics for all M and W patterns, which differ in their corresponding edges lengths not more than by a given percent value. This information makes it possible to forecast next ZigZag edge for every, even non-standard, M or W pattern, provided that it's discovered in the history. The process is repeated 7 times for different ZigZag ranges, and then the results are generalized as an average target price and recommendation to buy, to sell, or to wait.
This indicator builds zigzag by HZZM indicator. The indicator is updated bar by bar (there is no tick processing).
The indicator shows a combination of 7 ZigZags in near history as yellow segments (the result is NOT a zigzag!). Expected edges of every of 7 ZigZags are shown in future as red or gray sections. Red color means satisfactory forecast, while gray color means insufficient data for observed configuration of waves. Red segments are used to calculate average target price and signal strength (the more consistently the final ZigZag extremums are located against current price, the larger the signal strength; and if the number of extremums above and below the price is equal, result is 0%—neither buy, nor sell). Target price is shown by means of a price mark, the signal strength is printed in preferred corner of the chart.
- HistoryDepth—Number of bars to use to gather statistics; default value 5,000;
- ZigZagRange—The largest zigzag range (in points) to be passed as corresponding parameter to the HZZM indicator; default value—0 means that indicator will autodetect overall range of current quotes and generate 7 appropriate custom ranges for every HZZM instance automatically; if a number 1000 or more entered, it is used as the largest range and other 6 smaller ranges are calculated from it by dividing it every time by ~1.4 (sqrt(2));
- Deviation—Maximal allowed difference (in percents) between corresponding edges in two figures, which makes these figures identical; by default 33; minimal value 10, maximal 50; recommended values 10, 20, 25, 33, 50;
- Corner—A corner used to display the label with decision; default value 3 (bottom right); other possible values: 0—upper left corner; 1—upper right corner; 2—bottom left corner;
- Offset—Number of bars to shift processing to the left; this allows analyzing indicator performance on the history; default value 0 shows prediction on the latest bar;
- Original—Parameter passed "as is" to the HZZM indicator; it switches the zigzag mode from standard HZZ to modified HZZM algorithm; please, see HZZM description for details; default value false;
The screenshots below demonstrate the indicator with default settings, except for the picture number 2, where Offset is 10, i.e. the bar highlighted with vertical dotted line is the last known bar to the indicator, and all what is to the right of the bar is a forecast.
- Initialization of some buffers was missing and now added.