This simple indicator can be used to catch the trend and the reversals.
study(title="Cumulative Donchian", shorttitle="Cum DC", overlay=false) // Author: samuelhei // Tips: 1NR9tyn8tAn6nuQzosaZ2SkfT38PLxN5mf // Feel free to use this script as you want! length = input(50, minval=1) lower = lowest(length) upper = highest(length) basis = avg(upper, lower) a = (low > basis) ? 1 : (high < basis) ? -1 : 0 plot(cum(a),'Cum DC')