Consolidation Ranges [kingthies]

Consolidation Range Analysis
Published by Eric Thies, January 2021

Indicator Summary
  • This tool calculates, analyzes and plots the visualization of a relative range over a given period of time
  • By adding to charts, users are enabled to see the impulsive nature of market cycles, along with their efforts to consolidate thereafter
  • The default period is 30, and should be adjusted to users preference
  • The default input is the current close price, on the chosen timeframe of the chart

Script Source

// [pine]
//© kingthies || This source code is subject to the terms of the Mozilla Public License 2.0 at
study("Consolidation Ranges [kingthies]", shorttitle="CR [kingthies]", overlay=true)

// !<------ User Inputs -----> 
[symbol=src]src[/symbol] = input(close, title='Range Input (Default set to Close'), lengthEMA=input(30,title='Length'),zoneToggle = input(true, title="Toggle Zone Highlights"), iCol =, 100), 

// !<---- Declarations & Calculations ---- > 
trndUp = float(na),trndDwn = float(na), mid = float(na), e = [__tag__=ema]ema[/__tag__]([symbol=src]src[/symbol], lengthEMA)
trndUp := [symbol=src]src[/symbol] < [symbol=nz]nz[/symbol](trndUp[1]) and [symbol=src]src[/symbol] > trndDwn[1] ? [symbol=nz]nz[/symbol](trndUp[1]) : high, trndDwn := [symbol=src]src[/symbol] < [symbol=nz]nz[/symbol](trndUp[1]) and [symbol=src]src[/symbol] > trndDwn[1] ? [symbol=nz]nz[/symbol](trndDwn[1]) : low, mid := [symbol=avg]avg[/symbol](trndUp, trndDwn)

// !< ---- Plotting -----> 
highRange = plot(trndUp == [symbol=nz]nz[/symbol](trndUp[1]) ? trndUp : na, color=color.white, linewidth=2, style=plot.style_linebr, title="Top of Period Range")
lowRange = plot(trndDwn == [symbol=nz]nz[/symbol](trndDwn[1]) ? trndDwn : na, color=color.white, linewidth=2, style=plot.style_linebr, title="Bottom of Period Range")
xzone = plot(zoneToggle ? [symbol=src]src[/symbol] > e ? trndDwn : trndUp : na, color=iCol, style=plot.style_circles, linewidth=0, editable=false)
fill(highRange, xzone, color=color.lime,transp=70), fill(xzone, lowRange,,transp=70)
// [/pine]

Script open-source

Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Vuoi usare questo script sui tuoi grafici?


its really great indicator.. thank you sir
It's a fantastic indicator! It prevents me from taking many losing trades! Thanks so much!
Awesome indicator. 100% accurate entry points. You are a genius. Thank you.
Please specify the operating rules, I am not very good at using it
The default period is 30, and should be adjusted to users preference. What are the days, hours, candles expressed in?
Hello World!