ZIGZAG Base High/Low (Arrays)

ZIGZAG Base High/Low (Arrays)

ZigZag base indicator

Calculation is done on High and Lows. A high point is identified, if the highest bar is the current bar.  A low point is identified, if the lowest bar is the current bar.

This can be base of any kind of zigzag based indicator.
All zigzag points and his values are stored to a set of arrays.
It will count LH Lower Highs and HL Higher Lows, if HH OR LL occured then LH or HL counter is 0.
It can be used for 1-2-3 pattern or any other pattern algos.
It will also save some ratio value ratio, rizeratio, Barratio.
–   Ratio : current move against lasmove 1 = 100% retracement 0.5 = 50% retracement
–   Barratio : current move bar length against lasmove bar length
–   Sizeration current move against last move of the same direction.

Paramters:

AllowDouble     = Allow New High or Low points at the same bar
AllowOverflow  = Force a new High or Low Point, if no new high or low point was found after cLength
CheckUpOrDownCandle = New high or low points are only allowed if Candle is up for highs or is down for lows

It return the last 4 zigzag point at the last barindex. Maybe usefull, when will use it for a breakout strategy. If you don’t want this, then replace the “return” line with a simple “return.

Code:

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Nicolas • 95 days ago #

    Thanks a lot for this nice contribution to the community! I’m eager to see what’s next! 🙂

  2. Alain • 94 days ago #

    Good job. cLength is not defined in the parameters list. So, always equal to 1, which gives very small zigzags.

    • gidien • 94 days ago #

      Thanks for the hint. I think i know now, why this happen. The “settings” block was added by the reviewer. I believe, that it could be difficult to find all parameters directly in the sourcecode.

      I will add this block next time directly to the source code.

      The correct settings block:

      // —– settings —–
      MaxBars = 1000
      ShowLabel = 1
      AllowDouble = 0 //Allow New High or Low points at the same bar
      AllowOverflow = 1 //Force a new High or Low Point, if no new high or low point was found after cLength
      CheckUpOrDownCandle = 0 //New high or low points are only allowed if Candle is up for highs or is down for lows
      cLength = 3 // how many bars lookback to find highs or lows
      // ——————–

      I think , it would be a nice feature to have the possibilty to declare input parameters inside the source code in the next version:
      Like this:
      INPUT(“Name”, “Description”, Type(integer, bool…) , Value)

  3. LucasBest • 83 days ago #

    Thank you for sharing your work, both original and very disconcerting. When I went through the code, two things struck me (if I may):
    1 – we are closer to a fractal code than a zigzag code. The fractal code determines the new highs and lows based on a minimum bar number (horizontality). The Zigzag code determines that there is a change of direction from a certain vertical movement. This minimum vertical movement to change direction can sometimes be done in 1 bar… This makes the Zigzag code (based on verticality = prices) more responsive and often more consistent, because it is the price that counts.
    2 – The code erases everything and redo all the calculations at each new bar, which is incongruous and especially very time-consuming…

    • gidien • 79 days ago #

      Hello LucasBest,

      thanks for your comment.

      Point 1:
      Yes your are right. The Zigzag version is more fractal based. For me a ZZ indicator should show turning points (highs and lows).
      So the calculation should be done on candle high and candle low. With “vertical” calculation(percentage) you can see some jumping ZZ points.
      Example: If you see serveral Dojis with long shadows, then the high and low of this candle can be in the range of the percentage change, even if the low or high is not lower or higher then the candle before.
      Thats why i prefer to indentify ZZ points as higher highs or lower lows.

      Point2:
      Yes your are right. The goal was to limit the calculation to a specific range of bars. Sometimes i have open a chart with 10k bars. If i would do the calculation over all bars, then the time for calculation would take longer the first time.
      I can remove the calculation loop. But i don’t know, how to update this post with the new code.

      best regards

      Gidien

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
philippe59139 Bravo super travail
Nicolas Il doit y avoir impérativement plus d'unités affichées que le paramètre "BarsLimit". Ceci ét...
steffen_burat Hello Nicolas, I have a cumulative histogram update problem, the indicator often updates ...
taklause Hello Nicolas, if I try to use your indicator in a trading system, the error on prc pops up ...
jonpt88 hI . THIS LOOKS GOOD. Thanks. Just one doubt: is this kind of impulse indicator - does it sh...
effegi
1 year ago
effegi A good alternative solution, even I had thought of the variant that uses high and low (proba...
Seb did you automate that 1-2-3 strategy? how is that working for you?
effegi Not yet, I'm busy developing other strategies/indicators at the moment, but it's on my to-do...
StephFor //ind1 = ZigZagPoint[2*averagetruerange[200]](close) avr = 3 //3% ind1 = ZigZag[avr](close...
Manu L. @Steph un grand merci pour ton aide mais :-( J'ai copier le code tel quel mais cependant j...
AlphaMauss Je n'ai pas réussi à faire fonctionner l'indicateur avec le code fourni en commentaire sur P...
Meta Signals Pro Pleasure ! Please let us know if you make good trades with it and if you see improvements we...
francis59 Bonjour, Bonjour, comment puis-je créer un screener basé sur cet indicateur, qui affiche le...
Trader Sab I am curious to try it how, however I get an error message for line 47 and 48 - drawsegment,...
datageek How do I change the thickness of the line or change it too dashed lines? Kind regards
lkiklkik NE fonctionne pas ( ou plus ... )
Nicolas il faut modifier toutes les références à top par itop et bottom par ibottom. Ces mots étant ...
teddy58 Ich habe es mit N= 1,5 und N=2,5 getestet mit 200000 Einheiten. Es funktioniert leider erst ...
Matriciel I use this indicator to help me make a decision when there is a divergence. The divergences ...
Jan Wind Hi, I personnaly am not a big fan of ZIGZAG indicator, as it repaints itself during time. ...
Nicolas Sure, I suggest you open a new topic in the forum to discuss about your ideas.
hdgm Bonjour Nicolas, est ce que l'on peut en faire une stratégie de trading automatisée ?
Nicolas Non, pas en utilisant l'indicateur zigzag traditionnel de la plateforme.
TACBOLSA
6 years ago
Tradingrob Hi Tac Bolsa, thanks for the information. But after carefully ready all the material i still...
TAC Bolsa Hello, the indicator creates the support depending on the volume and is dynamic.
carlvan Not working on PRT 11.1. And the site https://www.tiburonesdealetacorta.com does not exist....
rama I want to use this indicator in trading system, it says zig zag is obsolete and not supported
Nicolas Right, due to its repainting behavior, the zigzag is not allowed in automated trading with r...
rama I noticed it changes as time progress, I am 7 as the average, how many period it wont chang...
Nicolas
8 years ago
Nicolas add it on price chart, change the cp parameter according to the period you want to observe f...
Robert22 hola buenos días: yo estoy buscando una cosa parecida para realizar con ello un indicador de...
Nicolas https://www.prorealcode.com/prorealtime-indicators/rsi-classical-hidden-divergences-indicator/

Top