This is ZigZag with Fibonacci Retracement script. It calculates the using Higher Time Frame, draw lines and put labels accordingly. I already published with Fibonacci Levels script but this one is and I didn't want to change/update it.
You can set Period and Resolution as you wish. is calculated using higher time frames (ex: 1day) so you better choose small numbers as Period, such 2, 3 etc. you should choose higher time frame wisely, meaning that you should not set 1Day while chart resolution is 1min ;)
It draws Fibonacci levels between 0%-100% and If the price goes higher/lower than 100% level than the script draws Fibonacci Levels accordingly. This means it draws Fibonacci levels until this levels get higher/lower than the price.
"Show Zig Zag" is not enabled by default, you can enable it if you want to see as well.
You have options to set Text Color, Line Color, Up Color and Down Color.
You can set the location of the Fibonnaci Levels -> Left or Right
You also have option to enable/disable following Fibonnaci Levels:
I added "Colorful Fibonacci Levels" for fun. if you enable it then Fibonacci line colors will be different randomly on each move, see it for yourself :)
if you enable "Show Option":
how the script adjust levels automatically:
if you set Label Location as "Right":
if you enable "Colorful Fibonacci Levels" then Line colors will be changed on each move randomly ;)
round_to_mintick() function used
bar_index is used for labels (instead of time)
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.