本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Smollet
//@version=6
indicator("NR3-100 / Inside Day / BlastOff", overlay=false, max_bars_back=100)
// Current bar range
barRange = high - low
// Maximum Narrow Range value for the current bar
int nrValue = 0
int matchedBars = 1
// NRn means:
// The current bar range <= the range of each of the previous n-1 bars.
for i = 1 to 99
if na(barRange[i])
break
if barRange <= barRange[i]
matchedBars := i + 1
else
break
// Show only NR3 and higher
nrValue := matchedBars >= 3 ? matchedBars : 0
// Histogram
plot(nrValue >= 3 ? nrValue : na, title="Narrow Range", color=color.aqua, style=plot.style_columns, linewidth=2)
// Lower boundary of the displayed NR range
hline(3, "NR3", linestyle=hline.style_dotted)
// Inside Day condition
insideDay = high < high[1] and low > low[1]
// Display Inside Day marker above the NR histogram, or at level 3 if the bar is not NR
plotshape(insideDay ? (nrValue >= 3 ? nrValue + 6 : 3) : na, title="Inside Day", style=shape.circle, location=location.absolute, size=size.small, color=color.lime)
// Larry Williams BlastOff
blastOff = barRange > 0.0 ? math.abs(close - open) / barRange : na
blastOffSignal = blastOff < 0.20
// BlastOff < 20% marker below zero
plotshape(blastOffSignal ? -2.0 : na, title="BlastOff < 20%", style=shape.labelup, location=location.absolute, size=size.small, color=color.orange)