本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//© ╦ ╦═╗ ╦
//© ║ ╠╦╝ ║
//© ╚╝ ╩╚═ ╩═╝
//
// ATR Pivots
//@version=4
study("[JRL] ATR Pivot Points", shorttitle="[JRL] ATR Pivots", overlay=true)
// ##############################################################################################
// INPUTS #######################################################################################
// ##############################################################################################
// {
atrLen = input(title="Period", type=input.integer, defval=15)
nRes = input(title="Pivot Timeframe", type=input.resolution, defval="W")
size = input(0.25, title="ATR Multiplier")
// }
// ##############################################################################################
// PIVOTS AND ATR ###############################################################################
// ##############################################################################################
// {
dailyopen = security(syminfo.tickerid, nRes, hlc3)
ATR = security(syminfo.tickerid, nRes, atr(atrLen))
// }
// ##############################################################################################
// PLOTTING LINES ###############################################################################
// ##############################################################################################
// {
// Pivot Line
plot(barstate.isconfirmed ? dailyopen : na, color=color.red, linewidth=2, style=plot.style_circles, title="Period open")
// ATR Resistance Lines
plot(barstate.isconfirmed ? dailyopen + ((size * 1) * ATR) : na, color=color.yellow, linewidth=1, style=plot.style_circles, title="Resistance 1")
plot(barstate.isconfirmed ? dailyopen + ((size * 2) * ATR) : na, color=color.yellow, linewidth=1, style=plot.style_circles, title="Resistance 2")
plot(barstate.isconfirmed ? dailyopen + ((size * 3) * ATR) : na, color=color.orange, linewidth=1, style=plot.style_circles, title="Resistance 3")
plot(barstate.isconfirmed ? dailyopen + ((size * 4) * ATR) : na, color=color.orange, linewidth=1, style=plot.style_circles, title="Resistance 4")
plot(barstate.isconfirmed ? dailyopen + ((size * 5) * ATR) : na, color=color.maroon, linewidth=1, style=plot.style_circles, title="Resistance 5")
// ATR Support Lines
plot(barstate.isconfirmed ? dailyopen - ((size * 1) * ATR) : na, color=color.green, linewidth=1, style=plot.style_circles, title="Support 1")
plot(barstate.isconfirmed ? dailyopen - ((size * 2) * ATR) : na, color=color.green, linewidth=1, style=plot.style_circles, title="Support 2")
plot(barstate.isconfirmed ? dailyopen - ((size * 3) * ATR) : na, color=color.teal, linewidth=1, style=plot.style_circles, title="Support 3")
plot(barstate.isconfirmed ? dailyopen - ((size * 4) * ATR) : na, color=color.teal, linewidth=1, style=plot.style_circles, title="Support 4")
plot(barstate.isconfirmed ? dailyopen - ((size * 5) * ATR) : na, color=#015826, linewidth=1, style=plot.style_circles, title="Support 5")
// }