INVITE-ONLY SCRIPT

Bcnk——MFB

54
//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)

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.