ZigZag Average

ZigZag Average

The basic algorithm for this indicator is Zig Zag indicator. Each time a new peak or trough is found, the averaged value are inverted:

  • if last ZigZag point is a peak: the moving average is calculated with Highs
  • if last ZigZag point is a trough: the moving average is calculated with Lows

This indicator was coded by a request in the English indicators forum.


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?

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

  1. Forexcheckup • 234 days ago #

    Thank you vey much for your swift response, hope others find it useful!

  2. Stenozar • 234 days ago #

    Hi Forexchekup! on which instruments do you use it?

  3. Glen Marquis • 231 days ago #

    Nice. I like this, are the graphics as pretty when used with market entries?

    • Nicolas • 231 days ago #

      Because of its natural behavior, the zigzag makes the indicator more pretty in the past as it is in real time.. Using another kind of peaks and troughs detection should make it more accurate and valuable for trading.

  4. eckaw • 225 days ago #

    I’m trying to make a strategy based on EMA crosses over the ZigZag Average. Is there a way to generate these signals and copy them onto “myIndicator2” and simply print the signals (for example: +1; -1) ? If this is possible, maybe the strategy can be built with myIndicator2, then overcoming the ZigZag issue with auto trading. Any thoughts?

    • Nicolas • 224 days ago #

      Yes, this could be easily programmed with the assisted creation tool.

  5. Karthick S • 202 days ago #

    Hi Nicolas,
    Can you please share MT4 version of this?

    • Nicolas • 202 days ago #

      No. This website is only dedicated to ProRealTime programming 🙂

Register or


avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Stenozar Thanks Leo!
Madrosat Hi Leo something is missing in the strategy above because it does not work at all as it is
Leo I don't know, I just copy paste the strategy. The optimisation of the values I wrote them in...
osupero Buenisimo Sr Nicolas, seria posible que sólo marcara por encima o por debajo de una media mo...
osupero https://www.screencast.com/t/1FD7s0YdZ......DE NUEVO MIL GRACIAS
Nicolas Alpha transparency from 0 to 255.
ehtsham Hi, Sir can you tell me how to put this code in indicator plz
Jan Wind Ehtsham, all you need to do is change the code in line 18 and line 20 (see the code above...
ottimo Congratulations Nicolas, What should I do for the 2 files I have to add them both in the gr...
Nicolas Only the "//PRC_StepALMA-VHF Hi/Lo band" is required, it uses the second code automatically....
ottimo Thank you Nicolas, great indicator, N. 1
Nicolas Yes, that's how it goes when using loops..
JosephFelix Hi, Could I please have help with adding these indicators 'on price'? Every indicator that I...
Nicolas Just add it on price by clicking the wrench on the left upper side of the price chart.
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. ...
Gianluca WOW! i was looking for something like this! Thank you!
Tradingrob Hi Nicolas, when i upload this indicator in my list and use it as indicator. I get a totally...
Nicolas Apply it on the price chart. The indicator plot just one single line. There are two in the...
TAC Bolsa
7 months ago
TAC Bolsa Thank yo
isurutharaka hallo how to dwonload it
TAC Bolsa https://www.tiburonesdealetacorta.com
tradingpro salve io faccio spread trading e volevo sapere come impostare un profitto da chiudere in a...
Nicolas Per favore non fare domande generali, non correlate al post. Usa invece il forum.
Appsoluxions Hi Nicolas, do you have the MT4 version of the indicator? I am not sure if these kind of que...
Nicolas Hi, don't have one sorry. But you can still ask for private coding through our programming s...
Appsoluxions Cool. Thanks for the response.
odin here is my code c1 = ExponentialAverage[3](close) c2 = ExponentialAverage[5](close) c3 ...
juanj HI Odin Can you also kindly provide the code for the 'Short Term Trader Squezze' indicato...
odin this is the short term Trader squezze indicator. short term Trader in Trouble and squezze is...
Rafa And the PriceMAPeriod? aren´t the same?
Nicolas The PriceMAPeriod is the period to make the average of all the last X medianprice found.
Rafa Thanks a lot Nicolás. Have a nice day
JanWd Hey Doctrading, I tried your code, optimising the A and V and the RSI period, see below. ...
Glen Marquis This will work as there is plenty of room for the Target before the Stop, yet the Stop would...
magicT I did a copy and paste of this code and PRT 10.3 returns a synthax mistake: OneTradePerD...
swapping merci gabri, on va le mettre à l'essai ;)
Genotik Merci de votre contribution !
Leo Hi all, I posted a new version of this indicator ( I just add arrows to spot the local maxi...
Trading_En_El_Ibex35 Muchas Gracias por compartir este interesante indicador. Un saludo