OPEN-SOURCE SCRIPT

Anchored Auto Fibonacci Retracement with Alerts [ImaWrknMan]

SYNOPSIS

Automatically generates a Fibonacci Retracement anchored to the candle of your choosing. As price moves further away from the anchor point, the fib levels automatically adjust to represent the entirety of the move.

BULLISH VS. BEARISH

It automatically detects if the Fibonacci Retracement should be drawn from the low or high of the anchored candle by considering the candles that follow (if they produce new highs, it will use the anchored candle low; if they produce new lows, it will use the anchored candle high).

MITIGATION

If the Fibonacci levels are fully retraced (i.e., price pulls back beyond the originating price), the levels will remain on the chart but it will no longer adjust as new candles form - it will become static.

OPTIONS

The following options are offered:

Extend Retracement Levels
The Fibonacci Retracement levels will extend beyond the last candle into the future. These extensions are visually represented using dashed lines.

Retracement Levels
Twelve levels are supported. The default levels mirror those used by the standard Fibonacci Retracement tool. Select only the levels you want to see on the chart. Line color can also be customized to your liking. You can optionally define an alert condition and alert message for each level (see "Alerts" below).

ALERTS

To receive an alert when price retraces into a level, check the "Alert" box to the right of that level. You can optionally define the text to display in the alert by entering it in the text box to the right of the alert checkbox. Levels with alerts will be marked on the chart with a "bell" symbol. Once you've selected the alerts you want to receive and (optionally) the text for each alert, create an Alert for the indicator.

NOTE: You do NOT need to create a separate Alert for each level.

Limitations

  • Alerts can only be defined for levels that fall between 0 and 1.
  • Once an alert is created, its settings are fixed. Any changes to the settings after the Alert is created will have no effect on the existing Alert. In this case, the Alert should be recreated.
  • Alert notifications will only be generated for visible levels.


Other Alerts

  • Alert on expansion - Use this alert option if you want to be notified when price moves further from the anchored price, causing the retracement levels to adjust. This is useful if you have Limit orders at current levels and you want to cancel or move them when the levels change.
  • "Alert on mitigation" - Use this alert option if you want to be notified when the Fibonacci Retracement has been fully retraced.


The code for this indicator was inspired by the Fibonacci Toolkit by LuxAlgo
Pivot points and levelsTrend Analysis

Open-source script

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 publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer