RECON ATR Volatility Percentage
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RECONTRADER

//@version=5

//ATR Volatility Percentage with Adjustable Lookback Period

indicator(title="RECON ATR Volatility Percentage", shorttitle="RECON ATR Percentage", overlay=false, precision=0)

// Input
ATRlength = input(30, title="ATR Length")
PeriodLB = input(90, title="Period Look Back Length")

// ATR Percentage Calculations
atrpercent = ta.hma(ta.tr, ATRlength)
PercentageRank = ta.percentrank(atrpercent, PeriodLB)

// ATR Percentage Colors
color = PercentageRank <= (25) ? color.red : PercentageRank > (25) and PercentageRank < (50) ? color.aqua : PercentageRank >= (50) and PercentageRank <= (75) ? color.yellow : PercentageRank >= (75) ? color.lime : color.silver

// Plot
plot(PercentageRank, title="ATR Percentage Columns", style = plot.style_columns, linewidth=3, color=color)