Skip to content

Instantly share code, notes, and snippets.

@rajvermacas
Created December 7, 2025 04:35
Show Gist options
  • Select an option

  • Save rajvermacas/7a3f8eea32e792f857df0d064e21e056 to your computer and use it in GitHub Desktop.

Select an option

Save rajvermacas/7a3f8eea32e792f857df0d064e21e056 to your computer and use it in GitHub Desktop.
ADR Average Daily Range Pinescript
//@version=5
indicator("ADR Percentage", shorttitle="ADR%", overlay=false)
len = input.int(20, title="Length", minval=1)
tf = input.timeframe("1D", title="Timeframe")
threshold = input.float(5.0, title="Threshold %", minval=0.0)
adrPct = request.security(syminfo.tickerid, tf, 100 * (ta.sma(high / low, len) - 1))
plot(adrPct, title="ADR%", color=color.blue, linewidth=2)
hline(threshold, title="Threshold", color=color.red, linestyle=hline.style_dashed)
alertcondition(adrPct > threshold, title="ADR% Exceed", message="ADR% > threshold")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment