Autodrawn Pivot Levels Indicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © spiritualhealer117

//@version=5
indicator("Pivot Levels")
len = int(input(14,"short length"))
llen = int(input(20,"long length"))
sens = float(input(0.5,"Sensitivity"))

sum = 0
std = ta.stdev(close,llen)

for i=0 to len
    if (close[i] < (close + sens*std)) and (close[i] > (close-sens*std))
        sum += 1

if sum >= 0.5*len
    line.new(bar_index-len,close,bar_index,close,xloc.bar_index,color=color.new(color.orange,75),width=1,extend=extend.both)
