OPEN-SOURCE SCRIPT
Fibonacci retracement

Hi all!
This indicator will show you the most recent Fibonacci retracement in the current trend. So if the trend is bullish the Fibonacci retracement will be drawn from swing low to high and from swing high to low in a bearish trend.
The uniqueness in this script lies in the adaptation to trend. To only plot the Fibonacci retracements according to the current market trend.
The trend is determined through break of structures (BOS) and change of characters (CHoCH). A change of character can be of type change of character plus (with a failed swing) and will then be shown as CHoCH+. This is possible through my library 'MarketStructure' (tradingview.com/script/tqFlUGel-MarketStructure/). It only uses break of structures and change of characters to be able to determine the trend, if you want a more detailed picture of the market structure you can use my script 'Market structure' (tradingview.com/script/ud6AQSm2-Market-structure/).
History and what to look for
Fibonacci retracement levels are used by many traders and are levels that are not Fibonacci sequence numbers themselves but they deriver from them. Some examples are:
23,6% - Divide a number by one three places ahead (e.g. 13/55)
38,2% - Divide a number by the one two places ahead (e.g. 21/55)
50% - Not from the Fibonacci sequence, but it's a number that price has reacted from in the past. Markets tend to retrace half a move before continuing
61,8% - The "golden retracement level". It derives from the "golden ratio" and is a core component of the Fibonacci sequence. The further you go in the Fibonacci sequence the preceding number divided by the current number will get closer and closer to this "golden ratio". This level is considered the most important Fibonacci retracement level by many traders
78,6% - Square root of 61.8%. This is often considered a deep correction (but not a trend reversal) and are often used for late entries
These levels are considered "key" and most significant. You want to look for a retracement of the price (down in a bullish trend and up in a bearish trend) to give you good entries.
Settings
For the trend you can set the pivot/swing lengths (right and left) and use the checkbox if you want these pivots to have labels. This can be done in the 'Market strucure' section.
In the 'Fibonacci retracement' section there is settings for the actual Fibonacci retracement. You can enable the trendline, set the color and the style of it. You can select which levels that should be shown by the indicator. There are 11 levels enabled by default, they are; 0-4.236. All settings in this section tries to be as similar to the "Fib Retracement" tool in Tradingview. You can also select the style of these lines (solid, dashed or dotted) and if you want them to extend to the right or not.
After this you can select if the Fibonacci retracement should be reversed or not, if prices should be displayed, if levels should be displayed and if to show the decimal levels or percentages and lastly the font size of these labels.
All defaults are based on the "Fib Retracement" tool by Tradingview.
Visualization
This indicator aims to be as visually similar to the default ("Fib Retracement") tool here on Tradingview. It will plot the Fibonacci retracement (called Auto Fibonacci/Auto fib) according to the trend from the library 'MarketStrucure'. The big differences from the "Fib Retracement" tool by Tradingview is that it's automatic (that adapts to trend), the market structure is visualized through lines and labels (showing 'BOS' for break of structures and 'CHoCH'/'CHoCH+' for change of characters) and that the labels showing information about the levels are positioned to be highly visible (left if <50% otherwise right if in a bullish trend, vice versa in a bearish trend or if reversed).
Don't hesitate if you have any feedback or nice feature suggestions!
Best of trading luck!
This indicator will show you the most recent Fibonacci retracement in the current trend. So if the trend is bullish the Fibonacci retracement will be drawn from swing low to high and from swing high to low in a bearish trend.
The uniqueness in this script lies in the adaptation to trend. To only plot the Fibonacci retracements according to the current market trend.
The trend is determined through break of structures (BOS) and change of characters (CHoCH). A change of character can be of type change of character plus (with a failed swing) and will then be shown as CHoCH+. This is possible through my library 'MarketStructure' (tradingview.com/script/tqFlUGel-MarketStructure/). It only uses break of structures and change of characters to be able to determine the trend, if you want a more detailed picture of the market structure you can use my script 'Market structure' (tradingview.com/script/ud6AQSm2-Market-structure/).
History and what to look for
Fibonacci retracement levels are used by many traders and are levels that are not Fibonacci sequence numbers themselves but they deriver from them. Some examples are:
23,6% - Divide a number by one three places ahead (e.g. 13/55)
38,2% - Divide a number by the one two places ahead (e.g. 21/55)
50% - Not from the Fibonacci sequence, but it's a number that price has reacted from in the past. Markets tend to retrace half a move before continuing
61,8% - The "golden retracement level". It derives from the "golden ratio" and is a core component of the Fibonacci sequence. The further you go in the Fibonacci sequence the preceding number divided by the current number will get closer and closer to this "golden ratio". This level is considered the most important Fibonacci retracement level by many traders
78,6% - Square root of 61.8%. This is often considered a deep correction (but not a trend reversal) and are often used for late entries
These levels are considered "key" and most significant. You want to look for a retracement of the price (down in a bullish trend and up in a bearish trend) to give you good entries.
Settings
For the trend you can set the pivot/swing lengths (right and left) and use the checkbox if you want these pivots to have labels. This can be done in the 'Market strucure' section.
In the 'Fibonacci retracement' section there is settings for the actual Fibonacci retracement. You can enable the trendline, set the color and the style of it. You can select which levels that should be shown by the indicator. There are 11 levels enabled by default, they are; 0-4.236. All settings in this section tries to be as similar to the "Fib Retracement" tool in Tradingview. You can also select the style of these lines (solid, dashed or dotted) and if you want them to extend to the right or not.
After this you can select if the Fibonacci retracement should be reversed or not, if prices should be displayed, if levels should be displayed and if to show the decimal levels or percentages and lastly the font size of these labels.
All defaults are based on the "Fib Retracement" tool by Tradingview.
Visualization
This indicator aims to be as visually similar to the default ("Fib Retracement") tool here on Tradingview. It will plot the Fibonacci retracement (called Auto Fibonacci/Auto fib) according to the trend from the library 'MarketStrucure'. The big differences from the "Fib Retracement" tool by Tradingview is that it's automatic (that adapts to trend), the market structure is visualized through lines and labels (showing 'BOS' for break of structures and 'CHoCH'/'CHoCH+' for change of characters) and that the labels showing information about the levels are positioned to be highly visible (left if <50% otherwise right if in a bullish trend, vice versa in a bearish trend or if reversed).
Don't hesitate if you have any feedback or nice feature suggestions!
Best of trading luck!
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.