mrtools wrote: Tue Dec 20, 2022 11:31 am
Not sure what type of channel that is don't think a donchian channel would work.
I found it Mr Tools
Code: Select all
//@version=2
study("Motion To Attraction Channels",shorttitle="MTA-Channels",overlay=true)
length = input(14)
//
alpha = 1/length
a = close > nz(A[1],close) ? close : nz(a[1],close)
b = close < nz(B[1],close) ? close : nz(b[1],close)
c = change(b) ? nz(c[1]) + alpha : change(a) ? 0 : nz(c[1])
d = change(a) ? nz(d[1]) + alpha : change(b) ? 0 : nz(d[1])
//
avg = avg(a,b)
A = c*avg+(1-c)*a
B = d*avg+(1-d)*b
//
plot(A,color=#0080FF,transp=0),plot(B,color=#FF0040,transp=0)