RicardoSantos

[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.
Skript med en öppen källkod

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.

Vill du använda det här skriptet i ett diagram?
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)