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 • 138 days ago #

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

  2. Stenozar • 137 days ago #

    Hi Forexchekup! on which instruments do you use it?

  3. Glen Marquis • 135 days ago #

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

    • Nicolas • 135 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 • 129 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 • 127 days ago #

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

  5. Karthick S • 105 days ago #

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

    • Nicolas • 105 days ago #

      No. This website is only dedicated to ProRealTime programming 🙂

Register or


avatar avatar avatar avatar avatar avatar
Related users ' posts
TAC Bolsa
3 months ago
Enzo Paliotti Complimenti, un ottimo lavoro!!!
TAC Bolsa Thank yo
isurutharaka hallo how to dwonload it
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
JM David, Thanks a lot and next week I begin the test of this strategy in real... You have ot...
rejo007 hello david, i'll try it could you tell me wich strategy do you use in real? thanks
David Somogyi Hello, I have a couple of DAX strategies of breakout and mean reversion. I'll try to post...
Thomas007 Is there any way to build something similar for FX? I wonder what would be the replacement f...
Kris75 Hi Bolsatrilera, I love this indicator! Thanks; => did you develop a strategy around...
supertiti Felicidades Laurenzo d'avoir pris le temps pour ce gros travail et en plus dans l'esprit du ...
gatarayihajp Hello,  It's very interesting indicator. Could you explain more about it? Thank a lot
dkinse Hey, Yes it´s running in 30 m timeframe. I had it running and it made two trads in januar...
Wing There's a few threads on the forum about backtest and live trades being different at times. ...
ET I agree with verdi55. As it is now, the code will only test for a breakout on the upside (li...
Marcot18 Buongiorno, è possibile codificare lo stesso codice per regressione lineare? grazie in anticipo
Nicolas Just change the indicator at line 9 with a linearregression instead of average
Marcot18 Save Nicolas, non ci riesco puoi postarmelo grazie.
David Balance thanks for sharing this excellent indicator.  Here are some thoughts.  please ad...