Nicolas

Fractals ZigZag

Category: Indicators By: Nicolas Created: July 28, 2016, 7:17 PM
July 28, 2016, 7:17 PM
Indicators
31 Comments
Fractals ZigZag

This indicator is a new attempt to draw compatible zigzag for automated trading with ProOrder.

The zigzag are drawn with the new fractal point that is contrarian to the last one.

The “cp” parameter control the depth of analysis to find fractals, higher is the value, deeper are the valleys and taller the peaks. Default value is 20.

//---external parameters
//cp = 20

once lastpoint = 0

if high[cp] >= highest[2*cp+1](high) then
 LH = 1
else
 LH = 0
endif

if low[cp] <= lowest[2*cp+1](low)  then
 LL = -1
else
 LL = 0
endif

if LH = 1 then
 TOPy = high[cp]
 TOPx = barindex[cp]
endif

if LL = -1 then
 BOTy = low[cp]
 BOTx = barindex[cp]
endif

if LH>0 and (lastpoint=-1 or lastpoint=0) then
 DRAWSEGMENT(lastX,lastY,TOPx,TOPy) COLOURED(200,0,0,255)
 DRAWTEXT("■",TOPx,TOPy,Dialog,Bold,20) coloured(200,0,0,255)
 lastpoint = 1
 lastX = TOPx
 lastY = TOPy
endif

if LL<0 and (lastpoint=1 or lastpoint=0) then
 DRAWSEGMENT(lastX,lastY,BOTx,BOTy) COLOURED(0,200,0,255)
 DRAWTEXT("■",BOTx,BOTy,Dialog,Bold,20) coloured(0,200,0,255)
 lastpoint = -1
 lastX = BOTx
 lastY = BOTy
endif

RETURN 

Download
Filename: PRC_FractalsZigZag.itf
Downloads: 1406
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Robert22
8 years ago
#

hola buenos días: yo estoy buscando una cosa parecida para realizar con ello un indicador de divergencias con el precio y el RSI y no se donde estais escribiendo sobre éste tema, alguien podría decirmelo?

Nicolas
8 years ago
#

https://www.prorealcode.com/prorealtime-indicators/rsi-classical-hidden-divergences-indicator/

ullle73
8 years ago
#

when i add this indicator nothing happens? all black on indicator, same goes when adding it to price chart

Nicolas
8 years ago
#

add it on price chart, change the cp parameter according to the period you want to observe for new fractals to pop up. Be sure your PRT platform is version >= 10.3

JanWd
8 years ago
#

Dear Nicolas, and others, Third comment: my solution as presented does not work satisfactory with my previous presented code, sorry. It should present in the graph only fractal points that a x % higher or lower as the previously fractal point, but that does not always appear in the graph, sometimes the next top fractal point is even lower as the previous bottom fractal point, which is maybe caused by the limited bars used for the calculation and the setting of the point of reference, CP bars in the past ? Alternatively code below, which is easier to read, but regrettable gives still not my desired result. Sometimes the next top fractal point is even lower as the previous bottom fractal point or vice versa, if close[cp] >= highest[2*cp+1](close) and close[cp] >= BOTy[1] *(1+ Perc) then //top, base for short LH = 1 else LH = 0 endif if close[cp] <= lowest[2*cp+1](close)and close[cp] <= TOPy[1]*(1- Perc) then //bottom, base for long LL = -1 else LL = 0 endif Comments or remarks would be appreciated. Nice weekend, Jan

Nicolas
8 years ago
#

Hi Jawd, good idea. Should be interesting to discuss the code in a separated thread in the forum. I'll meet you there, thank you.

JanWd
8 years ago
#

Dear Nicolas, Forget my previous post, apparently too many text with an appendix, text was mixed up, hereby new try: I extended your Fractals Zigzag indicator with a minimum percentage of change before a fractal point will be set, like the percentage you can choose in the standard PRT-ZIGZAG indicator. This is meant to avoid Fractal Points in a relative flat market. I tested the adjusted code, and it seems to work correctly. The changes I made are shown in CAPITAL LETTERS below, (all other code remains the same.) (I based the adjusted Fractals Zig Zag code on the CLOSE, not on the original high/low in your code, because the original PRT ZigZag indicator is also based on the Close) //—external parameters cp = cp1 // default 20 Perc = perc1/10000 // default 2% = highest[2*cp+1](close) AND CLOSE[CP] >= LOWEST[2*CP+1](CLOSE)*(1+ PERC) then //top, base for short <== RENEWED LINE LH = 1 else LH = 0 endif if close[cp] <= lowest[2*cp+1](close) AND CLOSE[CP] <= HIGHEST[2*CP+1](CLOSE)*(1- PERC) then //bottom, base for long <== RENEWED LINE LL = -1 else LL = 0 endif If you have any comments please let me know. Kind regards, Jan

JanWd
8 years ago
#

Dear Nicolas, I extended your Fractals Zigzag indicator with a minimum percentage of change before a fractal point will be set, like the percentage you can choose in the standard PRT-ZIGZAG indicator. This is meant to avoid Fractal Points in a relative flat market. I tested the adjusted code, and it seems to work correctly. The changes I made are shown in CAPITAL LETTERS below, (all other code remains the same.) (I based the adjusted Fractals Zig Zag code on the CLOSE, not on the original high/low in your code, because the original PRT ZigZag indicator is also based on the Close) //---external parameters cp = cp1 // default 20 Perc = perc1/10000 // default 2% = highest[2*cp+1](close) AND CLOSE[CP] >= LOWEST[2*CP+1](CLOSE)*(1+ PERC) then //top, base for short <== RENEWED LINE LH = 1 else LH = 0 endif if close[cp] <= lowest[2*cp+1](close) AND CLOSE[CP] <= HIGHEST[2*CP+1](CLOSE)*(1- PERC) then //bottom, base for long = highest[2*cp+1](close) and close[cp] >= lowest[2*cp+1](close)*(1+ Perc) then //top, base for short LH = 1 else LH = 0 endif if close[cp] <= lowest[2*cp+1](close)and close[cp] 0 and (lastpoint=-1 or lastpoint=0) then DRAWSEGMENT(lastX,lastY,TOPx,TOPy) COLOURED(200,0,0,255) DRAWTEXT("■",TOPx,TOPy,Dialog,Bold,20) coloured(200,0,0,255) lastpoint = 1 lastX = TOPx lastY = TOPy endif if LL<0 and (lastpoint=1 or lastpoint=0) then DRAWSEGMENT(lastX,lastY,BOTx,BOTy) COLOURED(0,200,0,255) DRAWTEXT("■",BOTx,BOTy,Dialog,Bold,20) coloured(0,200,0,255) lastpoint = -1 lastX = BOTx lastY = BOTy endif RETURN

beppe8949
9 years ago
#

non ho capito perdonami!

beppe8949
9 years ago
#

Ciao Nicolas, perchè quando aggiungo l'indicatore, viene aggiunto in basso e non sul grafico? Grazie mille!

Nicolas
9 years ago
#

Por favor agrégalo al precio, gracias.

pvzyl
9 years ago
#

good day I am trading the SA 40 on IG markets , I am using the basics like trend lines and zig zag ,but I don't see anyone write any strategies on the SA 40 , I want to know why and where can I find some of those

maximus78
9 years ago
#

Ciao Nicolas, potresti fare un esempio di come l'utilizzeresti in un sistema automatico invece del normale zig zag? Grazie Massimo

Nicolas
9 years ago
#

Ci sono già molte strategie che utilizzano questo indicatore nella libreria, basta cercare "zigzag" con lo strumento di ricerca del sito.

Eusebio Garcia Nuez
9 years ago
#

ondas de wolf please

Petrus
10 years ago
#

Hi Nicolas. Nice indicator, as always!

It could be very useful to detect some waves on the graphic. Could it be possible to mark the last 5 points with the text 1, 2, 3, 4 and 5, in addition of the green and red boxes?

Petrus
10 years ago
#

Thanks Nicolas. Done.

Nicolas
10 years ago
#

Yes of course, please add a new request in the ProBuilder forum.

ghary
10 years ago
#

D'accord cela donnerai quoi au niveau du code, je vais voir au niveau visuel si c'est parlant ou pas assez pertinent.. merci pour la réponse rapide...

Nicolas
10 years ago
#

Suite à une autre demande, un screener pour la détection des instruments ayant eu un nouveau Fractal depuis les X dernières bougies a était codé et est disponible ici : http://www.prorealcode.com/prorealtime-market-screeners/fractals-stock-screener/

Nicolas
10 years ago
#

L'indicateur en question existe déjà pour la version 10.2, c'est celui-ci = http://www.prorealcode.com/prorealtime-indicators/bill-williams-fractals/

ghary
10 years ago
#

Bonjour je reviens sur cette indicateur intéressant, ne peut on sur la V2 mettre des croix ou autre à la place des carrés coloriés afin d'indiquer le fractale plus bas, plus haut du zigzag ? si oui que faut il remplacer ?

merci....

Nicolas
10 years ago
#

On peut retourner les valeurs de BOTy et de TOPy pour connaître les derniers Fractals trouvés. Puisqu'on ne peut pas tracer dans le passé avec la version 10.2, ces valeurs apparaîtront à partir du moment où elles seront trouvés et donc en décalage par rapport la bougie en question, le rendu visuel ne sera pas du tout le même.

miguel33
10 years ago
#

Nicolas ,

con IG si collega alla versione 10.2 

ho provato ad inserire l'indicatore nella versione in demo 10.3 

lo accetta ma non si vede nulla esce completamente bianco. :-(

cosa miguel immagine dici in proposito ?

grazie per la tua collaborazione

miguel

supertiti
10 years ago
#

Sur Telefonica n'apparaissent pas les derniers plus haut/plus bas !!??  un commentaire svp

 

http://zupimages.net/viewer.php?id=16/30/dezu.jpg

Nicolas
10 years ago
#

En effet, c'est ce que je viens de spécifier à Zilliq. Puisque on ne peut pas supprimer et retracer des éléments déjà tracés, j'ai pris le partie de ne tracer que les plus haut et plus bas que si le précédent était un signal inverse. Tu peux modifier ce comportement en supprimant tout ce qui se rapporte à "lastpoint" dans le code. Bien entendu, les précédents signaux resteront tracés sur le graphique.

zilliq
10 years ago
#

Thanks Nicolas,

I didn't read the code at all ;-)

Have a good day

Zilliq

miguel33
10 years ago
#

Ciao nicolas,

anche io non riesco ad inserire il tuo codice .

mi da errore di sintassi linea 29 e 30 .

come posso riparare ?

potresti postare un codice leggibile ?

grazie 

miguel

Nicolas
10 years ago
#

Questo indicatore è compatibile solo con la versione 10.3 di ProRealTime.

ProRealCode ProRealCode
Loading...