Fib Thirds - Price Scale Only

greeksgainer · study · 30 行 · 点赞 2 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

//@version=6
indicator("Fib Thirds - Price Scale Only", overlay=true)
 
p1 = input.price(22922.45, "Point 1 (top or bottom)", group="Anchor points")
p2 = input.price(22411.30, "Point 2 (other end)",     group="Anchor points")
 
col   = input.color(color.orange, "Level colour", group="Style")
hlOn  = input.bool(true, "Highlight levels around current price", group="Style")
hlCol = input.color(color.aqua, "Highlight colour", group="Style")
 
hi   = math.max(p1, p2)
lo   = math.min(p1, p2)
step = (hi - lo) / 3
 
l0 = hi
l1 = hi - step
l2 = hi - 2 * step
l3 = lo
 
zone = close > l1 ? 1 : close > l2 ? 2 : 3
 
c0 = hlOn and zone == 1 ? hlCol : col
c1 = hlOn and (zone == 1 or zone == 2) ? hlCol : col
c2 = hlOn and (zone == 2 or zone == 3) ? hlCol : col
c3 = hlOn and zone == 3 ? hlCol : col
 
plot(l0, "Level 0",      color=c0, display=display.price_scale)
plot(l1, "Level 0.3333", color=c1, display=display.price_scale)
plot(l2, "Level 0.6667", color=c2, display=display.price_scale)
plot(l3, "Level 1",      color=c3, display=display.price_scale)

← 返回列表