本页源码来自 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/
// © declarative
//@version=6
indicator("Turtle Zone", "TurtleZone", overlay = true)
import TradingView/ta/9
import KevanoTrades/Ehlers_Super_Smoother/2 as ess
_source = input.source(hlc3, 'Price Source')
source = math.log(_source)
length = input.int(200, 'Lookback Period', minval = 1)
float inner_amp = input.float(5.6, title = "Inner Mutiplier")
float outer_amp = input.float(9.6, title = "Outer Amplitude")
var a1 = math.exp(-math.sqrt(2) * math.pi / length)
var c2 = 2 * a1 * math.cos(math.sqrt(2) * math.pi / length)
var c3 = -math.pow(a1, 2)
var c1 = 1 - c2 - c3
tr = math.max(math.log(high) - math.log(low), math.abs(math.log(high) - math.log(nz(close[1], close))), math.abs(math.log(low) - math.log(nz(close[1], close))))
smooth(x) =>
ess.twoPole(x, length)
float mean = smooth(source)
float tr_mean = smooth(tr)
plot(math.exp(mean), color = color.new(color.blue, 60), style = plot.style_line, title = 'Mean', linewidth = 2, display = display.none)
upper_outer = plot(math.exp(mean + outer_amp * tr_mean), color = color.red, title = 'Upper Zone Upper Line', display = display.none)
upper_inner = plot(math.exp(mean + inner_amp * tr_mean), color = color.red, title = 'Upper Zone Lower Line', display = display.none)
fill(upper_inner, upper_outer, color.new(color.red, 90), title = 'Upper Zone')
lower_outer = plot(math.exp(mean - outer_amp * tr_mean), color = color.green, title = 'Lower Zone Upper Line', display = display.none)
lower_inner = plot(math.exp(mean - inner_amp * tr_mean), color = color.green, title = 'Lower Zone Lower Line', display = display.none)
fill(lower_inner, lower_outer, color.new(color.green, 90), title = 'Lower Zone')