Pivot Points High Low (With confirm bar)

Wised123 · study · 32 行 · 点赞 763 · TradingView 原页

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

Pine Script

//@version=6
indicator("Pivot Points High Low (With confirm bar)", shorttitle="Pivots HL (CB)", overlay=true, max_labels_count=500)
 
lengthGroupTitle = "LENGTH LEFT / RIGHT"
colorGroupTitle = "Text Color / Label Color"
leftLenH = input.int(title="Pivot High", defval=10, minval=1, inline="Pivot High", group=lengthGroupTitle)
rightLenH = input.int(title="/", defval=10, minval=1, inline="Pivot High", group=lengthGroupTitle)
labelColorH = input(title="", defval=#f23645, inline="Pivot High", group=colorGroupTitle)
 
leftLenL = input.int(title="Pivot Low", defval=10, minval=1, inline="Pivot Low", group=lengthGroupTitle)
rightLenL = input.int(title="/", defval=10, minval=1, inline="Pivot Low", group=lengthGroupTitle)
labelColorL = input(title="", defval=#089981, inline="Pivot Low", group=colorGroupTitle)
 
ph = ta.pivothigh(leftLenH, rightLenH)
pl = ta.pivotlow(leftLenL, rightLenL)
 
drawLabel1(_offset, _pivot, _style, _color) =>
    if not na(_pivot)
        label.new(bar_index[_offset], _pivot, " ", style=_style, color=_color)
        label.new(bar_index, _pivot, " ", style=label.style_circle, color=_color, size = size.tiny)
        line.new(bar_index, _pivot, bar_index, high, color = color.white, style = line.style_dotted)
        line.new(bar_index[_offset], _pivot, bar_index, _pivot, color = color.white, style = line.style_dotted)
 
drawLabel2(_offset, _pivot, _style, _color) =>
    if not na(_pivot)
        label.new(bar_index[_offset], _pivot, " ", style=_style, color=_color)
        label.new(bar_index, _pivot, " ", style=label.style_circle, color=_color, size = size.tiny)
        line.new(bar_index, _pivot, bar_index, low, color = color.white, style = line.style_dotted)
        line.new(bar_index[_offset], _pivot, bar_index, _pivot, color = color.white, style = line.style_dotted)
 
drawLabel1(rightLenH, ph, label.style_label_down, labelColorH)
drawLabel2(rightLenL, pl, label.style_label_up, labelColorL)

← 返回列表