INVITE-ONLY SCRIPT

Bcnk——MFB

32
//version=6
indicator(title = '', shorttitle = 'Bcnk——MFB', overlay = true)

length = input(title = 'Length', defval = 32)
offset = input(title = 'Offset', defval = 0)
src = input(close, title = 'Source')

// ZLSMA 计算
lsma = ta.linreg(src, length, offset)
lsma2 = ta.linreg(lsma, length, offset)
zlsma = lsma + lsma - lsma2

// 趋势方向(颜色用它控制)
isUp = zlsma >= zlsma[1]
col = isUp ? color.green : color.red

// 主线
plot(zlsma, color = col, linewidth = 3)

// ============================
// 变色(趋势方向变)就画箭头
// ============================

// 红 → 绿
upSignal = isUp and not isUp[1]

// 绿 → 红
downSignal = not isUp and isUp[1]

// 上箭头
plotshape(upSignal, title = 'Up Arrow', style = shape.arrowup, location = location.belowbar, color = color.new(color.green, 0), size = size.small)

// 下箭头
plotshape(downSignal, title = 'Down Arrow', style = shape.arrowdown, location = location.abovebar, color = color.new(color.red, 0), size = size.small)

Exención de responsabilidad

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.