You are on page 1of 1

study(title="Pivot Points H/L", shorttitle="Pivots H/L", overlay=true)

len = input(14, minval=1, title="Length")


//The length defines how many periods a high or low must hold to be a "relevant
pivot"

h = highest(len)
//The highest high over the length
h1 = dev(h, len) ? na : h
//h1 is a pivot of h if it holds for the full length
hpivot = fixnan(h1)
//creates a series which is equal to the last pivot

l = lowest(len)
l1 = dev(l, len) ? na : l
lpivot = fixnan(l1)
//repeated for lows

plot(hpivot, color=blue, linewidth=2, offset= -len+1)


plot(lpivot, color=purple, linewidth=2, offset= -len+1)
//plot(h1, color=black, style=circles, linewidth=4, offset= -len+1)
//plot(l1, color=black, style=circles, linewidth=4, offset= -len+1)

You might also like