Open
Description
https://www.tradingview.com/script/nXhuJpwr-Efficient-Trend-Step-Channel/
Can anyone code this indicator in python/numba please. Seems like i am getting stuck at this line not sure what it means
abs(change(src,length))/sum(abs(change(src)),length)
the result is supposedly a series but the seems to be a ratio of two series. Appreciate any help.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © alexgrover
//@version=4
study("Efficient Trend Step Channel",overlay=true)
length = input(100),fast = input(50),slow = input(200),src = input(close)
//----
er = abs(change(src,length))/sum(abs(change(src)),length)
dev = er*stdev(src*2,fast) + (1-er)*stdev(src*2,slow)
//----
a=0.,a := src > nz(a[1],src) + dev ? src : src < nz(a[1],src) - dev ? src : nz(a[1],src)
upper = valuewhen(change(a),a + dev,0)
lower = valuewhen(change(a),a - dev,0)