support and resistance by qutubkoreja
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © qutubkoreja

//@version=4
study("Bullseye Borders", overlay=true, max_bars_back = 600, precision=2)
//DC Channels
length = input(55, minval=1, title="DC Length")
lower = lowest (length)
upper = highest(length)
basis = avg(upper, lower)

uppp = avg(upper, basis)
dwww = avg(lower, basis)
up1= avg(upper, uppp)
dw1 = avg(lower,dwww)
up2 = avg(uppp, up1)
dw2 = avg(dwww, dw1)
up3 = avg(upper, up1)
dw3 = avg(lower, dw1)
up4 = avg(basis, up2)
dw4 = avg(basis, dw2)
up5 = avg(basis, up4)
dw5 = avg(basis, dw4)

p0 = plot(basis, color=color.orange, title="Middle Line", linewidth=1, transp=100)
p1 = plot(up1, "Up1", color=color.red, title="Up1", linewidth=1, transp=100)
p2 = plot(dw1, "Dw1", color=color.green, title="Dw1", linewidth=1, transp=100)
p3 = plot(up2, "Up2", color=color.red, title="Up2", linewidth=1, transp=100)
p4 = plot(dw2, "Dw2", color=color.green, title="Dw2", linewidth=1, transp=100)
p5 = plot(up3, "Up3", color=color.maroon, title="Up3", linewidth=1, transp=0)
p6 = plot(dw3, "Dw3", color=color.navy,title="Dw3", linewidth=1, transp=0)
p7 = plot(up4, "Up4", color=color.blue, title="Up4", linewidth=1, transp=100)
p8 = plot(dw4, "Dw4", color=color.blue, title="Dw4", linewidth=1, transp=100)
p9 = plot(up5, "Up5", color=color.orange, title="Up5", linewidth=1, transp=0)
p10 = plot(dw5, "Dw5", color=color.orange, title="Dw5", linewidth=1, transp=0)

fill(p7, p8, color=color.blue, transp=100, title="Middle Area")
fill(p3, p1, color=color.red, transp=70, title="Short Area")
fill(p4, p2, color=color.green, transp=70, title="Long Area")
fill(p9, p10, color=color.orange, transp=70, title="Stop Area")


// Script for Boring Candles  

BcB_Ratio = input(30, title="Tight Candle Body <=(%)",minval=5, maxval=95)
    
C2BR=(abs(open-close)*100/abs(high-low))

barcolor(C2BR<=BcB_Ratio ? color.navy:na)

//ALMA Alert Line (if you want to use price for alert)
src = input(close, title="Source")
len = input(5, title="Arnaud Legoux MA Length", type=input.integer, minval=1)
offset = input(0.9, title="ALMA Offset", type=input.float, minval=0.0001)
sigma = input(21, title="ALMA Sigma Value", type=input.integer, minval=1)
Alma = alma(src, len, offset, sigma)
plot(Alma, color=color.black, linewidth=1, transp=100)

// Script for the Last Hifh and Low (Breakout Trend Follower)
pvtLenL       = 3
pvtLenR       = 3
pvthi_ = pivothigh(high, pvtLenL, pvtLenR)
pvtlo_ = pivotlow(low, pvtLenL, pvtLenR)
stopBuff = input(0.0, minval=-2, maxval=2, title="Multi")
stopPerc = stopBuff*.01 
stopLevel = valuewhen(pvtlo_, low[pvtLenR], 0)
stopLevel2 = stopLevel - stopLevel*stopPerc
plot(stopLevel2, style=plot.style_line, color=color.aqua, show_last=1, linewidth=2, transp=0, trackprice=true)
buyLevel = valuewhen(pvthi_, high[pvtLenR], 0)
buyLevel2 = buyLevel + buyLevel*stopPerc 
plot(buyLevel2, style=plot.style_line, color=color.red, show_last=1, linewidth=2, transp=0, trackprice=true)