Winton: Fractal Efficiency Envelopes by point alfo

pointalgo · study · 21 行 · 点赞 16 · TradingView 原页

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

Pine Script

//@version=6
indicator("Winton: Fractal Efficiency Envelopes", shorttitle="Winton_Fractal", overlay=true)
 
len = input.int(14, "Lookback")
mult = input.float(1.8, "Band Width")
change = math.abs(close - close[len])
volatility = math.sum(math.abs(close - close[1]), len)
er = volatility != 0 ? change / volatility : 0
fractal_mult = mult * (1 + (1 - er)) 
basis = ta.sma(close, len)
dev = ta.stdev(close, len) * fractal_mult
upper = basis + dev
lower = basis - dev
plot(basis, "Baseline", color=color.rgb(249, 209, 62))
p1 = plot(upper, "Upper Fractal", color=color.teal)
p2 = plot(lower, "Lower Fractal", color=color.teal)
fill(p1, p2, color=color.new(color.teal, 90))
break_up = ta.crossover(close, upper)
break_dn = ta.crossunder(close, lower)
plotshape(break_up, "Fractal Breakout", shape.labelup, location.belowbar, color.teal, text="BREAK", textcolor=color.white, size=size.tiny)
plotshape(break_dn, "Fractal Breakdown", shape.labeldown, location.abovebar, color.orange, text="BREAK", textcolor=color.white, size=size.tiny)

← 返回列表