U/D ACR% [vnhilton]
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © vnhilton

//@version=5
indicator(title="U/D ACR% [vnhilton]", shorttitle='ACR%', overlay=false, format=format.mintick, timeframe="D", timeframe_gaps=false)
length = input(10, title='Length')

uACR = (ta.sma(high, length) - ta.sma(low, length)) * 100 / ta.sma(low, length)
dACR = (ta.sma(low, length) - ta.sma(high, length)) * 100 / ta.sma(high, length)

plot(uACR, color=color.new(color.green, 0), title='UACR%', linewidth=1)
plot(dACR, color=color.new(color.red, 0), title='DACR%', linewidth=1)