// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © yashp1334 //@version=4 // // @author LazyBear // // This is my custom channel derived from BB/STARC. This uses both ATR/STDEV for plotting the bounds. // I use COG for the base line (normally it is SMA/EMA). // // If you use this code in its original/modified form, do drop me a note. // strategy("COG Double Channel [LazyBear]", shorttitle="COGChannel_LB", overlay=true) src = close length = input(34) median=0 mult=input(2.5) offset = input(20) tr_custom() => x1=high-low x2=abs(high-close[1]) x3=abs(low-close[1]) max(x1, max(x2,x3)) atr_custom(x,y) => sma(x,y) dev = (mult * stdev(src, length)) basis=linreg(src, length, median) ul = (basis + dev) ll = (basis - dev) tr_v = tr_custom() acustom=(2*atr_custom(tr_v, length)) uls=basis+acustom lls=basis-acustom buySignal= crossover(lls,src) sellSignal= crossunder(uls,src) // Plot STDEV channel plot(basis, linewidth=1, color=color.navy, title="Median") lb=plot(ul, color=color.red, linewidth=1, title="BB+") tb=plot(ll, color=color.green, linewidth=1, title="BB-") fill(tb,lb, color.silver, title="Region fill") // Plot ATR channel plot(basis, linewidth=2, color=color.navy, title="Median") ls=plot(uls, color=color.red, linewidth=1, title="Starc+") ts=plot(lls, color=color.green, linewidth=1, title="Star-") fill(ts,tb, color.green, title="Region fill") fill(ls,lb, color.red, title="Region fill") // Mark SQZ plot_offs_high=2 plot_offs_low=2 sqz_f=(uls>ul) and (lls