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)

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.