[RS]Vector Flow Channel V0

EXPERIMENTAL: channel lines based on linear regression and exponential curves (only 3 steps tho) that can be customized to adjust the advance/decay start/middle/end of line plus the lenght of the steps, 2nd step is 4x longer then the 1st.

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
study(title="[RS]Vector Flow Channel V0", shorttitle="[RS]VFC.V0", overlay=true)
decay = atr(10)*0.005
stage1 = input(5)
stage2 = input(10)
stage3 = input(20)
countmax = input(100, type=float)
pretopvector01 = nz(topvector01[1], close)
topvector01 = close >= pretopvector01 ? close : pretopvector01 - (decay * topvector01finalcounter[1])
topvector01counter = n - valuewhen(close >= topvector01, n, 0)
topvector01finalcounter = topvector01counter <= countmax ? stage1 : topvector01counter <= countmax*4 ? stage2 : stage3

prebotvector01 = nz(botvector01[1], close)
botvector01 = close <= prebotvector01 ? close : prebotvector01 + (decay * botvector01finalcounter[1])
botvector01counter = n - valuewhen(close <= botvector01, n, 0)
botvector01finalcounter = botvector01counter <= countmax ? stage1 : botvector01counter <= countmax*4 ? stage2 : stage3

pt = plot(topvector01, color=(topvector01 == close ? na : black))
pb = plot(botvector01, color=(botvector01 == close ? na : black))
fill(pt, pb, color=blue, transp=90)