Nicolas

ZigZag Fibonacci levels

Category: Indicators By: Nicolas Created: October 17, 2018, 9:42 AM
October 17, 2018, 9:42 AM
Indicators
11 Comments
ZigZag Fibonacci levels

This indicator plot Fibonacci levels based on the ZigZag indicator of the platform.

The zigzag tops and bottoms are calculated within the “percent” setting and on candlesticks Close (not highs/lows).

Levels colours can be modified with the R,G,B setting, by default levels are plotted in yellow.

The “DaysBefore” setting is important, because it prevents or not previous Fibonacci levels to be plot or not on the price chart. Expand its value to a large number will ensure the levels will be detected and plotted for the higher timeframes. In fact, it all depends of the zigzag percentage and the timeframe you are using.

//PRC_ZigZag Fibonacci levels | indicator
//17.10.2018
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge

// --- settings
percent = 0.5
//color:
r=255
g=255
b=0
DaysBefore = 20
// --- end of settings

zz = zigzag[percent](close)

top = zz<zz[1] and zz[1]>zz[2]
bot = zz>zz[1] and zz[1]<zz[2]

if top then
 highlvl = high[1]
 startbartop = barindex[1]
 idate = date[1]
endif
if bot then
 lowlvl = low[1]
 startbarbot = barindex[1]
 idate = date[1]
endif

newtop = top<>top[1]
newbot = bot<>bot[1]

if newtop or newbot then
 fullrange = abs(highlvl-lowlvl)

 fibo236 = lowlvl+(fullrange*0.236)
 fibo382 = lowlvl+(fullrange*0.382)
 fibo50 = lowlvl+fullrange/2
 fibo618 = lowlvl+(fullrange*0.618)
 startbar = min(startbartop,startbarbot)

 //plot fibonacci levels
 if startbar<>lastplot and today-idate<DaysBefore then 
  drawsegment(startbar,highlvl,barindex,highlvl) coloured(r,g,b)
  drawtext("          100%",barindex,highlvl,Dialog,Standard,20) coloured(r,g,b)
  drawsegment(startbar,lowlvl,barindex,lowlvl) coloured(r,g,b)
  drawtext("          0%",barindex,lowlvl,Dialog,Standard,20) coloured(r,g,b)
  drawsegment(startbar,fibo236,barindex,fibo236) coloured(r,g,b)
  drawtext("          23.6%",barindex,fibo236,Dialog,Standard,20) coloured(r,g,b)
  drawsegment(startbar,fibo382,barindex,fibo382) coloured(r,g,b)
  drawtext("          38.2%",barindex,fibo382,Dialog,Standard,20) coloured(r,g,b)
  drawsegment(startbar,fibo50,barindex,fibo50) coloured(r,g,b)
  drawtext("          50%",barindex,fibo50,Dialog,Standard,20) coloured(r,g,b)
  drawsegment(startbar,fibo618,barindex,fibo618) coloured(r,g,b)
  drawtext("          61.8%",barindex,fibo618,Dialog,Standard,20) coloured(r,g,b)
  lastplot = startbar
 endif
endif

return

 

Download
Filename: PRC_ZigZag-Fibonacci-levels.itf
Downloads: 1265
Download
Filename: zigzag-fibonacci-levels-indicator.png
Downloads: 389
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

hdgm
4 years ago
#

Bonjour Nicolas, est ce que l'on peut en faire une stratégie de trading automatisée ?

Nicolas
4 years ago
#

Non, pas en utilisant l'indicateur zigzag traditionnel de la plateforme.

s00071609
7 years ago
#

Would it be possible to use 2 or 3 points to do the calculations done in this case using zigzag indicator. For example, use an object and plot 3 points then use these coordinates to get fib levels rather than using automatic zigzag? So, instead of top and bottom of zigzag, we would use two points indicated by an object eg, a simple line or in new version elliot ABC plots? Are these kinds of indicator generation supported?

Nicolas
7 years ago
#

Sure, I suggest you open a new topic in the forum to discuss about your ideas.

Kris75
8 years ago
#

Hello Nicolas, Il semble que la variable DaysBefore fasse planter la représentation graphique = quand je la supprime ça fonctionne parfaitement ; pour ma gouverne, quelle est l'idée derrière ? Bien à toi,

Nicolas
8 years ago
#

Peut-être à cause du manque d'historique. Celle-ci est utile pour limiter la quantité de retracement à afficher/trouver. C'est écrit dans la description pourtant :)

YEOMAN999
8 years ago
#

How can I see the ZigZag? Only Fibo is drawn. THX ./alex

Nicolas
8 years ago
#

Add the ZigZag indicator on the chart, and with the same percent setting as this indicator.

iloco17
8 years ago
#

Bonjour Nicolas Je débute et j'ai installé votre indicateur sur l'écran du prix mais je ne comprends pas comment il fonctionne car je n'ai aucun trait qui se dessine. J'ai installé aussi l'indicateur zigzag. Pourriez vous m'indiquer comment le mettre en place? Merci

Nicolas
8 years ago
#

Le seul paramètre c'est le pourcentage du zigzag, à modifier selon convenance et le timeframe employé. Assurez vous d'avoir suffisamment d'unités affichées sur l'écran.

Gianluca
8 years ago
#

WOW! i was looking for something like this! Thank you!

ProRealCode ProRealCode
Loading...