OPEN-SOURCE SCRIPT

Percentage Range Consolidation Histogram

Mis à jour
The Percentage Range Consolidation histogram is a measure of volatility, ranking current price range compared to past ranges.

🟩​ USAGE

snapshot

Here there are 2 heavy contractions of price shown on chart that lead to a big rally. Shows a possible way to approach trading this. Take into account that this is for illustration purposes only and these entry methods have not been tested for long term profitability.

snapshot

Same price behaviour.


🟩​ CALCULATION

The script will use 3 different ranges all configurable by the user to check for low volatility on different zone lengths. On default zone 1 will be 10 period, 2 will be 30 period and 3 is 50 periods long.

It will then measure the percentage these ranges have from top (highest close) to bottom (lowest close) and plot those numbers as 3 gray histograms.

For each of these histograms separately it will use 'percentage zone PNR Length setting' as a lookback to rank current zone percentage compared to past results.
How it will do that is using the 'percentage zone PNR % setting' it will draw a line using ta.percentile_nearest_rank() formula. At default this is 20% meaning that only 20% of lookback values where below this level.

When the histogram is below this white line (small range compared to past ranges) it will color the histogram. Yellow for zone 1, orange for zone 2 and blue for zone 3.


There is also a 'Percentage zone % filter' which you can use as a maximum % current zone for it to be considered a small range. On default this is set to 15%. You can turn this off by selecting 'median' as 'Consolidation filters' instead of 'all'. Or only use this by selecting 'percentage'

🟩​ BAR COLORING

Now that you understand how to find small ranges (contractions of price) with the indicator there is a bar coloring option in the indicator.

You can select how many of the 3 zones have to be ranging for it to color the bar. On default this is set to 3 so the script will only color when price is in a very small range. As illustrated by the above charts these can lead to the beginnings of big trends.
Notes de version
As requested by a user added alerts to the script and show them in script.

  • "Consolidation start" - Alerts when a new consolidation area is created.
  • "breaks top of range" - Alerts when closing price closes above top of consolidation range.
  • "breaks bottom of range" - Alerts when closing price closes below bottom of consolidation range.


snapshot
In case the break alerts are confusing here is a visual on how it works. Script will track highest highs and lowest lows in last consolidation area (as seen by red candles). When price is no longer consolidating and closes beyond one of these lines it removes them and sends an alert.
Notes de version
Changed background coloring for breaks to be red for short pressure and green for long pressure
Bands and ChannelsHistorical VolatilityVolatility

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?


✅ Learn how I trade as a FUND MANAGER with my private indicators here.

Website —> honestalgo.com
Website —> honestalgo.com
Website —> honestalgo.com

FREE telegram channel —> t.me/honestalgo
Aussi sur:

Clause de non-responsabilité