OPEN-SOURCE SCRIPT

Fibonacci Levels on Any Indicator [By MUQWISHI]

▋ INTRODUCTION :
A “Fibonacci Levels on Any Indicator” can be applied to any indicator to draw Fibonacci levels based on provided conditions of two price points to produce a sequence of horizontal line levels starting from 0% to 100% in addition to extension levels. The 0% level is measured as the start of retracement, while the 100% level is the beginning of the extension levels. This tool was developed to be easy to add to any indicator, and it could be valuable to some traders in terms of managing trades by setting targets and reducing risk in the trend direction.


_______________________
▋ USAGE:

➤ NEEDS TO IDENTIFY 4 ELEMENTS:
istantanea
1. Starting Point. What’re the conditions / When will the drawing of the Fibonacci levels begin?
2. Ending Point. What’re the conditions / When will the drawing of the Fibonacci levels end?
3. High Point. What is the price for a 100% Fibonacci level (0% for the downside)?
4. Low Point. What is the price for a 0% Fibonacci level (100% for the downside)?


➤ STARTING & ENDING POINTS CONDITIONS:
Need to specify the condition when the drawing of Fibonacci levels starts and ends, and the indicator shows different prepared conditions.
istantanea
  • New Phase: Import a value (plot) from an existing indicator, where its status changes from NaN to a real number.
  • Crosses Above/Below: Import a value(1) (plot) from an existing indicator, where it crosses above/below value(2).
  • Reversal Up/Down: Import a value(1) (plot) from an existing indicator, where it rises/decreases than the previous value(1).
  • First/Last Bar: Useful to draw stationary Fibonacci levels.



➤ UPPER & LOWER PIVOTS (0% & 100%):
Need to specify the two price points representing 0% & 100% Fibonacci levels to expose the sequence of Fibonacci lines.
istantanea
  • Upper Pivot. By default, the ATR Upper Band. It’s possible to import a custom value from an existing indicator.
  • Lower Pivot. By default, the ATR Lower Band. It’s possible to import a custom value from an existing indicator.



➤ FIBONACCI STYLING OPTIONS:
Ability to customize line & label style, color, reverse, and hide/show levels.
istantanea


_______________________
▋ IMPLEMENTATION:
Here are some examples of implementing the indicator.
Note: All presented examples below are for demonstration purposes, and they're not trading suggestions.


# Example 1: (Reversal Up/Down)
We want to implement Fibonacci levels on the Hull MA by mohamed982. Our requirements are as follows:
  • Fibonacci levels start when the Hull MA reverses up.
  • Fibonacci levels end when the Hull MA reverses down.
  • Upper Pivot is the ATR Upper Band.
  • Lower Pivot is the ATR Lower Band.

After adding the required indicator (Hull MA), here’re the implementation and results
istantanea


# Example 2: (Crosses Above/Below)
We want to implement Fibonacci Level on the Squeeze Momentum by LazyBear. Our requirements are as follows:
  • Fibonacci levels start when the Squeeze Momentum histogram crosses above 0.
  • Fibonacci levels end when the Squeeze Momentum histogram crosses below 0.
  • Upper Pivot is the Bollinger Upper Band.
  • Lower Pivot is the Bollinger Lower Band.

After adding the required indicators (Squeeze Momentum & Bollinger Band), here’re the implementation and results
istantanea


# Example 3: (Crosses Above/Below)
We want to implement Fibonacci Level on the Crossing Moving Averages. Our requirements are as follows:
  • Fibonacci levels start when the 20-EMA crosses above 100-MA.
  • Fibonacci levels end when the 20-EMA crosses below 100-MA.
  • Upper Pivot is the ATR Upper Band.
  • Lower Pivot is the ATR Lower Band.

After adding the required indicators (20-EMA & 100-MA), here’re the implementation and results
istantanea


# Example 4: (New Phase: When the previous value is NaN, and the current value is a real number.)
We want to implement Fibonacci Level on the Supertrend. Our requirements are as follows:
  • Fibonacci levels start when an up-Supertrend (green) line shows up.
  • Fibonacci levels end when a down-Supertrend (red) line shows up.
  • Upper Pivot is the down-Supertrend.
  • Lower Pivot is the up-Supertrend.

After adding the required indicator (Supertrend), here’re the implementation and results
istantanea


# Example 5: (First/Last Bar)
We want to implement Fibonacci Level between two points, 330 & 300. Our requirements are as follows:
  • Fibonacci levels start at first bar on the chart.
  • Fibonacci levels end at last bar on the chart.
  • Upper Pivot is 330.
  • Lower Pivot is 300.

Here’re the implementation and results.
istantanea
To customize the number of bars back (like 50 bars)
istantanea


_______________________
▋ Final Comments:
  • The “Fibonacci Levels on Any Indicator” is made to apply on other indicators for planning Fibonacci Levels.
  • It can be implemented in different ways, along with presented examples.
  • This indicator does not work with plots that were developed by drawing classes.



Please let me know if you have any questions.
Thank you.
Chart patternsFibonacci ExtensionFibonacci RetracementlevelsmovingavaragePivot points and levelsresistenceriskmangementsourcesupportTrend Analysis

Script open-source

In pieno spirito TradingView, l'autore di questo script lo ha pubblicato open-source, in modo che i trader possano comprenderlo e verificarlo. Un saluto all'autore! È possibile utilizzarlo gratuitamente, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Vuoi usare questo script sui tuoi grafici?



Trusted Pine Programmer, I Provide Coding Services. For Inquiries
► Website muqwishi.com/home/quotation/
► Telegram t.me/MUQWISHI


⛾ Support My Work on “Buy Me a Coffee” buymeacoffee.com/muqwishi
Anche su:

Declinazione di responsabilità