Zigzag Fibonacci – an addition required
Forums › ProRealTime English forum › ProBuilder support › Zigzag Fibonacci – an addition required
- This topic has 13 replies, 3 voices, and was last updated 5 years ago by Angus Thomson.
-
-
12/31/2019 at 2:35 PM #115653
Hello troops,
https://www.prorealcode.com/prorealtime-indicators/zigzag-fibonacci-levels/
I was wondering if anyone could help modify this to add on -23.6 -36.2% -50% and so on
It is of course an excellent indicator, although it could be more excellent.
Thanks
12/31/2019 at 3:08 PM #11565512/31/2019 at 3:18 PM #115657I think Angus means negative values. So the 0% fib is at the top and the 100% fib is at the bottom. So after an upwards zigzag line the fib would be 0% down to 100% and after a downwards zigzag line the fib would be 0% up to 100%.
Unfortunately I’m a bit too busy at the moment to have a go at it.
12/31/2019 at 3:42 PM #11566312/31/2019 at 5:19 PM #115668I found five minutes and came up with this modification that I think does what you want. (Not tested very much!)
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677//PRC_ZigZag Fibonacci levels | indicator//Modified by Vonasi 31122019 to return negative Fibonacci Levels//17.10.2018//Nicolas @ www.prorealcode.com//Sharing ProRealTime knowledge//defparam drawonlastbaronly=true// --- settings//percent = 0.5//color://r=255//g=255//b=0//DaysBefore = 20// --- end of settingszz = zigzag[percent](close)top = zz<zz[1] and zz[1]>zz[2]bot = zz>zz[1] and zz[1]<zz[2]if top thenhighlvl = high[1]startbartop = barindex[1]idate = date[1]endifif bot thenlowlvl = low[1]startbarbot = barindex[1]idate = date[1]endifnewtop = top<>top[1]newbot = bot<>bot[1]if newbot thenfullrange = abs(highlvl-lowlvl)fibo236 = lowlvl+(fullrange*0.236)fibo382 = lowlvl+(fullrange*0.382)fibo50 = lowlvl+fullrange/2fibo618 = lowlvl+(fullrange*0.618)startbar = min(startbartop,startbarbot)titlea = 100titleb = 0endifif newtop thenfullrange = abs(highlvl-lowlvl)fibo236 = highlvl-(fullrange*0.236)fibo382 = highlvl-(fullrange*0.382)fibo50 = highlvl-fullrange/2fibo618 = highlvl-(fullrange*0.618)startbar = min(startbartop,startbarbot)titlea = 0titleb = 100endif//plot fibonacci levelsif startbar<>lastplot and today-idate<DaysBefore thendrawsegment(startbar,highlvl,barindex,highlvl) coloured(r,g,b)drawtext(" #titlea#%",barindex,highlvl,Dialog,Standard,10) coloured(r,g,b)drawsegment(startbar,lowlvl,barindex,lowlvl) coloured(r,g,b)drawtext(" #titleb#%",barindex,lowlvl,Dialog,Standard,10) coloured(r,g,b)drawsegment(startbar,fibo236,barindex,fibo236) coloured(r,g,b)drawtext(" 23.6%",barindex,fibo236,Dialog,Standard,10) coloured(r,g,b)drawsegment(startbar,fibo382,barindex,fibo382) coloured(r,g,b)drawtext(" 38.2%",barindex,fibo382,Dialog,Standard,10) coloured(r,g,b)drawsegment(startbar,fibo50,barindex,fibo50) coloured(r,g,b)drawtext(" 50%",barindex,fibo50,Dialog,Standard,10) coloured(r,g,b)drawsegment(startbar,fibo618,barindex,fibo618) coloured(r,g,b)drawtext(" 61.8%",barindex,fibo618,Dialog,Standard,10) coloured(r,g,b)lastplot = startbarendifreturn12/31/2019 at 7:31 PM #11567012/31/2019 at 8:04 PM #11567101/04/2020 at 12:41 PM #115869I was hoping for something more like the attached
01/04/2020 at 6:30 PM #11589301/04/2020 at 7:53 PM #115894Not being funny but all you did was make the font smaller and the line less thick
Have another go please
01/04/2020 at 9:41 PM #115899Not being funny but all I did was read your poor description of what you wanted which even GraHal didn’t understand and then code something that I thought you wanted. My code does what I described in my second post so it is far more than just a font size change. I changed the font size only because the large size was ugly.
Perhaps a thanks instead of an insult would be more of an incentive to assist further.
01/04/2020 at 9:46 PM #115900Not being funny but all you did was make the font smaller and the line less thick
Vonasi changed the Indicator so that …
- from a Top we can see / read the % Fib retrace down from the Top.
- from a Bottom we see / read the % Fib retrace up from the Bottom.
01/05/2020 at 3:13 PM #115930Here you go. This one not only inverts the fibs but draws your negative value fibs too. Another five minutes of life I won’t get back as they are pretty pointless because price never gets into the negative because if it does then the ZigZag redraws and so does our indicator as we no longer have a new bottom or a new top!
I didn’t waste too much time on it so not really tested and you might find the odd bug.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103//PRC_ZigZag Fibonacci levels | indicator//Modified by Vonasi 05012019 to return negative Fibonacci Levels v2//17.10.2018//Nicolas @ www.prorealcode.com//Sharing ProRealTime knowledge//defparam drawonlastbaronly=true// --- settings//percent = 0.5//color://r=255//g=255//b=0//DaysBefore = 20// --- end of settingszz = zigzag[percent](close)top = zz<zz[1] and zz[1]>zz[2]bot = zz>zz[1] and zz[1]<zz[2]if top thenhighlvl = high[1]startbartop = barindex[1]idate = date[1]endifif bot thenlowlvl = low[1]startbarbot = barindex[1]idate = date[1]endifnewtop = top<>top[1]newbot = bot<>bot[1]if newbot thenfullrange = abs(highlvl-lowlvl)fibo0 = lowlvlfibo236 = lowlvl+(fullrange*0.236)fibo382 = lowlvl+(fullrange*0.382)fibo50 = lowlvl+fullrange/2fibo618 = lowlvl+(fullrange*0.618)fibo100 = lowlvl+fullrangefibo236n = lowlvl-(fullrange*0.236)fibo382n = lowlvl-(fullrange*0.382)fibo50n = lowlvl-fullrange/2fibo618n = lowlvl-(fullrange*0.618)fibo100n = lowlvl-fullrangestartbar = min(startbartop,startbarbot)endifif newtop thenfullrange = abs(highlvl-lowlvl)fibo0 = highlvlfibo236 = highlvl-(fullrange*0.236)fibo382 = highlvl-(fullrange*0.382)fibo50 = highlvl-fullrange/2fibo618 = highlvl-(fullrange*0.618)fibo100 = highlvl-fullrangefibo236n = highlvl+(fullrange*0.236)fibo382n = highlvl+(fullrange*0.382)fibo50n = highlvl+fullrange/2fibo618n = highlvl+(fullrange*0.618)fibo100n = highlvl+fullrangestartbar = min(startbartop,startbarbot)endif//plot fibonacci levelsif startbar<>lastplot and today-idate<DaysBefore thendrawsegment(startbar,fibo0,barindex,fibo0) coloured(r,g,b)drawtext(" 0%",barindex,fibo0,Dialog,Standard,10) coloured(r,g,b)drawsegment(startbar,fibo100,barindex,fibo100) coloured(r,g,b)drawtext(" +100%",barindex,fibo100,Dialog,Standard,10) coloured(r,g,b)drawsegment(startbar,fibo100n,barindex,fibo100n) coloured(r,g,b)drawtext(" -100%",barindex,fibo100n,Dialog,Standard,10) coloured(r,g,b)drawsegment(startbar,fibo236,barindex,fibo236) coloured(r,g,b)drawtext(" +23.6%",barindex,fibo236,Dialog,Standard,10) coloured(r,g,b)drawsegment(startbar,fibo382,barindex,fibo382) coloured(r,g,b)drawtext(" +38.2%",barindex,fibo382,Dialog,Standard,10) coloured(r,g,b)drawsegment(startbar,fibo50,barindex,fibo50) coloured(r,g,b)drawtext(" +50%",barindex,fibo50,Dialog,Standard,10) coloured(r,g,b)drawsegment(startbar,fibo618,barindex,fibo618) coloured(r,g,b)drawtext(" +61.8%",barindex,fibo618,Dialog,Standard,10) coloured(r,g,b)drawsegment(startbar,fibo236n,barindex,fibo236n) coloured(r,g,b)drawtext(" -23.6%",barindex,fibo236n,Dialog,Standard,10) coloured(r,g,b)drawsegment(startbar,fibo382n,barindex,fibo382n) coloured(r,g,b)drawtext(" -38.2%",barindex,fibo382n,Dialog,Standard,10) coloured(r,g,b)drawsegment(startbar,fibo50n,barindex,fibo50n) coloured(r,g,b)drawtext(" -50%",barindex,fibo50n,Dialog,Standard,10) coloured(r,g,b)drawsegment(startbar,fibo618n,barindex,fibo618n) coloured(r,g,b)drawtext(" -61.8%",barindex,fibo618n,Dialog,Standard,10) coloured(r,g,b)lastplot = startbarendifreturn1 user thanked author for this post.
01/06/2020 at 2:04 PM #116054Thank you Vonasi I appreciate your hard work and I apologise for the poor description, please don’t feel like what you did was pointless.
-
AuthorPosts
Find exclusive trading pro-tools on