Smoothed Pivot Points

Sofien-Kaabar · study · 31 行 · 点赞 786 · TradingView 原页

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

Pine Script

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Sofien-Kaabar
 
//@version=5
indicator("Smoothed Pivot Points", overlay = true)
lookback_piv  = input(defval = 24, title = 'Pivot Lookback')
 
// Pivot points
// Adjusted highs
adjusted_high = ta.highest(high, lookback_piv)
 
// Adjusted lows
adjusted_low = ta.lowest(low, lookback_piv)
 
// Adjusted close
adjusted_close = ta.sma(close, lookback_piv)
 
// Pivot point
pivot_point = (adjusted_high + adjusted_low + adjusted_close) / 3
 
first_support    = (ta.lowest(pivot_point, 12)  * 2) - adjusted_high
first_resistance = (ta.highest(pivot_point, 12) * 2) - adjusted_low
 
found_support = close > first_support and close[1] < first_support[1]
found_resistance = close < first_resistance and close[1] > first_resistance[1]
 
plot(first_support, color = color.green)
plot(first_resistance, color = color.red)
 
plotshape(found_support,  style = shape.triangleup,   color = color.green,  location =  location.belowbar, size = size.small)
plotshape(found_resistance,  style = shape.triangledown, color = color.red,    location =  location.abovebar, size = size.small)

← 返回列表