Nicolas

Multi Fractals ZigZag High/Low

Category: Indicators By: Nicolas Created: August 3, 2016, 8:41 PM
August 3, 2016, 8:41 PM
Indicators
97 Comments
Multi Fractals ZigZag High/Low

Second version of this indicator, first one can be found here: http://www.prorealcode.com/prorealtime-indicators/fractals-zigzag/

This new version draw only High/Low points of the fractals zigzag on chart. It draws major points (green and red squares) which are calculated with a lookback of 20 periods by default (“cp” parameter can be changed at will).

The minor points (green and red dots) are calculated the same way but with the default period divided by 2 (so 20/2=10 periods by default).

This indicator can be used to trade 123 pattern of any other kind of breakout strategies.

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

once lastpoint = 0
ATR = averagetruerange[cp]

//---major zigzag points
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
DRAWTEXT("░",TOPx,TOPy+ATR/2,Dialog,Bold,20) coloured(200,0,0,255)
lastpoint = 1
endif
if LL<0 and (lastpoint=1 or lastpoint=0) then
DRAWTEXT("░",BOTx,BOTy-ATR/2,Dialog,Bold,20) coloured(0,200,0,255)
lastpoint = -1
endif

//---mino zigzag points
if high[round(cp/2)] >= highest[cp+1](high) then
LLH = 1
else
LLH = 0
endif

if low[round(cp/2)] <= lowest[cp+1](low)  then
LLL = -1
else
LLL = 0
endif

if LLH = 1 then
LTOPy = high[round(cp/2)]
LTOPx = barindex[round(cp/2)]
endif

if LLL = -1 then
LBOTy = low[round(cp/2)]
LBOTx = barindex[round(cp/2)]
endif

if LLH>0 then
DRAWTEXT("º",LTOPx,LTOPy+ATR/2,Dialog,Bold,20) coloured(200,0,0,255)
endif
if LLL<0 then
DRAWTEXT("º",LBOTx,LBOTy-ATR/2,Dialog,Bold,20) coloured(0,200,0,255)
endif

RETURN

 

Download
Filename: PRC_MultiFractalsZigZag.itf
Downloads: 1866
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

marc.schmid
6 years ago
#

Thanks a lot Nicolas!

marc.schmid
6 years ago
#

Dear Nicolas - your Multi Fractals ZigZag High/Low gives me quite good results - thanks for this! I would like to screen the markets with this Indicator but can not find it under "Screeners". As I'm quite new here, would like to ask you if you can help. Thanks.

Nicolas
6 years ago
#

There must be a lot of screeners built upon this indicator in the forums. First I found is here: https://www.prorealcode.com/topic/multi-fractales-zig-zag-supports-resistances/#post-29985

JMat45
7 years ago
#

In fact, it seems this code is not quite optimal. @Nicolas, is there a way to incorporate your Multi Fractals ZigZag High/Low code above with the Perfect Trend Line screener (https://www.prorealcode.com/topic/ayuda-screener-indicador-perfect-trend-line/#post-51291) so that when the trendline is broken to the upside for example, it auto draws the Fibonacci extensions on the CD leg (if you think of a typical ABCD pattern)? This would be a similar approach to the Ross Hook, except would flag an entry closer to the BC retracement level than Ross Hook (which triggers an entry when price moves through the B point). Thank you in advance.

Nicolas
7 years ago
#

Not optimal for what please? It is possible to combine all codes altogether if you want. Please open a dedicated topic for each of your demand.

JMat45
7 years ago
#

and in line 37...

JMat45
7 years ago
#

Thanks for this. Missing a zero in line 18 though.

Kris75
7 years ago
#

Here is this indicator with Fibo retracement //---external parameters //cp = 20 r=255 g=0 b=0 once lastpoint = 0 ATR = averagetruerange[cp] //---major zigzag points if high[cp] >= highest[2*cp+1](high) then LH = 1 else LH = 0 endif if low[cp] 0 and (lastpoint=-1 or lastpoint=0) then DRAWTEXT("▼",TOPx,TOPy+ATR/2,Dialog,Bold,20) coloured(200,0,0,255) lastpoint = 1 NewPeak = 1 LastHigherBarindex = TOPx LastHigher = TOPy startbartop = LastHigherBarindex else NewPeak = 0 endif if LL= highest[cp+1](high) then LLH = 1 else LLH = 0 endif if low[round(cp/2)] 0 then DRAWTEXT("º",LTOPx,LTOPy+ATR/2,Dialog,Bold,20) coloured(200,0,0) endif if LLL<0 then DRAWTEXT("º",LBOTx,LBOTy-ATR/2,Dialog,Bold,20) coloured(0,200,0) endif if NewPeak then fullrange = abs(lasthigher-lastlower) fibo236 = lastlower+(fullrange*0.236) fibo382 = lastlower+(fullrange*0.382) fibo50 = lastlower+fullrange/2 fibo618 = lastlower+(fullrange*0.618) fibo764 = lastlower+(fullrange*0.764) startbar = startbarbot endbar = startbartop //plot fibonacci levels if startbarlastplot then drawsegment(startbar,lasthigher,endbar,lasthigher) coloured(r,g,b) drawtext("100%",endbar,lasthigher,Dialog,Standard,10) coloured(r,g,b) drawsegment(startbar,lastlower,endbar,lastlower) coloured(r,g,b) drawtext("0%",endbar,lastlower,Dialog,Standard,10) coloured(r,g,b) drawsegment(startbar,fibo236,endbar,fibo236) coloured(r,g,b) drawtext("23.6%",endbar,fibo236,Dialog,Standard,10) coloured(r,g,b) drawsegment(startbar,fibo382,endbar,fibo382) coloured(r,g,b) drawtext("38.2%",endbar,fibo382,Dialog,Standard,10) coloured(r,g,b) drawsegment(startbar,fibo50,endbar,fibo50) coloured(r,g,b) drawtext("50%",endbar,fibo50,Dialog,Standard,10) coloured(r,g,b) drawsegment(startbar,fibo618,endbar,fibo618) coloured(r,g,b) drawtext("61.8%",endbar,fibo618,Dialog,Standard,10) coloured(r,g,b) drawsegment(startbar,fibo764,endbar,fibo764) coloured(r,g,b) drawtext("76.4%",endbar,fibo764,Dialog,Standard,10) coloured(r,g,b) lastplot = startbar endif endif if NewDown then fullrange = abs(lasthigher-lastlower) fibo236 = lasthigher-(fullrange*0.236) fibo382 = lasthigher-(fullrange*0.382) fibo50 = lasthigher-fullrange/2 fibo618 = lasthigher-(fullrange*0.618) fibo764 = lasthigher-(fullrange*0.764) startbar = startbartop endbar = startbarbot //plot fibonacci levels if startbarlastplot then drawsegment(startbar,lasthigher,endbar,lasthigher) coloured(r,g,b) drawtext("0%",endbar,lasthigher,Dialog,Standard,10) coloured(r,g,b) drawsegment(startbar,lastlower,endbar,lastlower) coloured(r,g,b) drawtext("100%",endbar,lastlower,Dialog,Standard,10) coloured(r,g,b) drawsegment(startbar,fibo236,endbar,fibo236) coloured(r,g,b) drawtext("23.6%",endbar,fibo236,Dialog,Standard,10) coloured(r,g,b) drawsegment(startbar,fibo382,endbar,fibo382) coloured(r,g,b) drawtext("38.2%",endbar,fibo382,Dialog,Standard,10) coloured(r,g,b) drawsegment(startbar,fibo50,endbar,fibo50) coloured(r,g,b) drawtext("50%",endbar,fibo50,Dialog,Standard,10) coloured(r,g,b) drawsegment(startbar,fibo618,endbar,fibo618) coloured(r,g,b) drawtext("61.8%",endbar,fibo618,Dialog,Standard,10) coloured(r,g,b) drawsegment(startbar,fibo764,endbar,fibo764) coloured(r,g,b) drawtext("76.4%",endbar,fibo764,Dialog,Standard,10) coloured(r,g,b) lastplot = startbar endif endif RETURN

oeil62
8 years ago
#

Merci pour le code ,vous dites que l'on peut l'utiliser avec 123 pattern,pourriez vous détailler cela avec un exemple merci

Nicolas
8 years ago
#

Vous trouverez de nombreux exemples de ce type de pattern en cherchant sur google :) L'idée étant de détecter facilement les pics et creux avec cet indicateur et d'identifier les breakouts.

mcha
9 years ago
#

Merci Nicolas pour cet indicateur à variable cp ajustable comment relier les points zigzag non pas par classe (points mineurs ou majeur) mais par leur succession alternative de high et de low

Nicolas
9 years ago
#

Merci de faire une demande spécifique à ce sujet dans le forum ProBuilder. J'y regarderai alors dés que possible.

Nicolas
9 years ago
#

Pour créer un espèce de canal ?

mcha
9 years ago
#

Encore félicitation pour cette réactivité. Je ne pensais pas aller aussi lojn mais si c'est faisable, les points de contact étant de potentiels point de rebond et on peut aller jusqu'à décompter (comme les vagues d'Eliott au sein d'un canal) cf indice DJ. Encore merci

redz
9 years ago
#

et aussi, quand y a le rond et la grille, cela veut dire que le signal est plus fort ?

redz
9 years ago
#

donc on peut scalper directement la bougie suivante, tres bon indicateur, bravo encore nicolas

redz
9 years ago
#

bonjour, tres indicateur, juste une question, les points apparaissent a la cloture de la bougie ou apres confirmation de la suivante ?

Nicolas
9 years ago
#

Les points hauts et bas apparaissent après une confirmation de X bougies définis par la variable "cp" paramétrable.

maisechogela
9 years ago
#

HI Nicolas, Thank you for the indicator. However, I am having a tough time loading the indicator onto metatrader 4, as I am not familiar with the the platform on the youtube video made. Please help

Nicolas
9 years ago
#

This website is dedicated to prorealtime programming, these codes are not compatible with MT4!

Abbeymac
9 years ago
#

I don't understand which folder we're to put this file. couldn't find it in my indicator folder after copyin it there, same thing as Template folder. What's needed to be done, please advise. Thanks

Nicolas
9 years ago
#

https://www.prorealcode.com/import-export-prorealtime-code-platform/

Real Pro
9 years ago
#

Hi Colin, How would one add horizontal lines from the pivot points? I'd like to try to create a system where one buys the breakout above the line. Thankyou.

wormtail
7 years ago
#

HI Realpro, did you ever find out how to add horizontal lines from these pivot points? Thanks

paulon
9 years ago
#

Hi Nicolas. I am very impressed with your work! 

For real-time charts, could the Multi Fractals High/Low indicator be adapted so that it triggers an alert when a high or low point is created?

Eusebio Garcia Nuez
9 years ago
#

please nicolas, ondas de wolf

 

Nicolas
9 years ago
#

It has been discussed many times, I believe already in the comments of this post or even in the forums. Please make a quick search :)

Pietro Fontana
9 years ago
#

Hi Nicolas,

i wanna use this indicator in an automatica trading strategy. but it seems that is not possibile. I've changed the code so the function will return the last value obtained  but it seems that it's not in sync with the draw. It a my error or is not possible to return the value for this indicator?

 

//---external parameters
//cp = 20
 
once lastpoint = 0
ATR = averagetruerange[cp]
 
//---major zigzag points
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
DRAWTEXT("░",TOPx,TOPy+ATR/2,Dialog,Bold,20) coloured(200,0,0,255)
lastpoint = 1
last = 2
endif
if LL<0 and (lastpoint=1 or lastpoint=0) then
DRAWTEXT("░",BOTx,BOTy-ATR/2,Dialog,Bold,20) coloured(0,200,0,255)
lastpoint = -1
last = -2
endif
 
//---mino zigzag points
if high[round(cp/2)] >= highest[cp+1](high) then
LLH = 1
else
LLH = 0
endif
 
if low[round(cp/2)] <= lowest[cp+1](low)  then
LLL = -1
else
LLL = 0
endif
 
if LLH = 1 then
LTOPy = high[round(cp/2)]
LTOPx = barindex[round(cp/2)]
endif
 
if LLL = -1 then
LBOTy = low[round(cp/2)]
LBOTx = barindex[round(cp/2)]
endif
 
if LLH>0 then
DRAWTEXT("º",LTOPx,LTOPy+ATR/2,Dialog,Bold,20) coloured(200,0,0,255)
last = 1
endif
if LLL<0 then
DRAWTEXT("º",LBOTx,LBOTy-ATR/2,Dialog,Bold,20) coloured(0,200,0,255)
last = -1
endif
 
RETURN last as "last"

Nicolas
9 years ago
#

Seems ok to me. However, you can take a look at this strategy that already show how to use it: https://www.prorealcode.com/prorealtime-trading-strategies/fractal-breakout-intraday-strategy-eurusd-1h/

ProRealCode ProRealCode
Loading...