本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=4
study("Pivot",overlay = true)
x = input(title = "left", type = input.integer, defval = 60)
y = input(title = "right", type = input.integer, defval = 30)
var pivot_high = high
var pivot_low = low
t_high = highest(x)
t_low = lowest(x)
if change(t_high, y) == false
pivot_high := t_high
if pivot_high != pivot_high[1]
line.new(bar_index-x, pivot_high, bar_index, pivot_high, xloc = xloc.bar_index, color = color.lime)
if change(t_low, y) == false
pivot_low := t_low
if pivot_low != pivot_low[1]
line.new(bar_index-x, pivot_low, bar_index, pivot_low, xloc = xloc.bar_index, color = color.red)
//plot(pivot_high, color = color.green, style = plot.style_cross)
//plot(pivot_low, color = color.orange, style = plot.style_linebr)