OPEN-SOURCE SCRIPT
Fractal FU

//version=5
indicator("Fractal FU", shorttitle="Fractal FU", overlay=true, max_labels_count=500)
// ===== Inputs
showBull = input.bool(true, "Show aligned bullish balls")
showBear = input.bool(true, "Show aligned bearish balls")
bullCol = input.color(color.blue, "Bull ball color")
bearCol = input.color(color.red, "Bear ball color")
ballSize = input.string("small", "Ball size", options=["tiny","small","normal","large","huge"])
gateTo15 = input.bool(true, "Gate to 15m close (clean, fewer signals)")
showDebug = input.bool(false, "Show per-timeframe debug dots")
// ===== Helpers
// one-liner you asked for:
f_sig(res) => request.security(syminfo.tickerid, res, (high > high[1] and low < low[1]) ? (close > open ? 1 : close < open ? -1 : 0) : 0, barmerge.gaps_off, barmerge.lookahead_off)
// Pull confirmed signals from each TF
sig1 = f_sig("1")
sig5 = f_sig("5")
sig10 = f_sig("10")
sig15 = f_sig("15")
// Alignment (all four agree)
bullAll = showBull and (sig1 == 1 and sig5 == 1 and sig10 == 1 and sig15 == 1)
bearAll = showBear and (sig1 == -1 and sig5 == -1 and sig10 == -1 and sig15 == -1)
// Emit control
emit15 = ta.change(time("15"))
emit = gateTo15 ? emit15 : barstate.isconfirmed // if not gated, show wherever alignment is true
// ===== Debug (tiny dots at bar to verify which TFs are firing)
plotshape(showDebug and sig1 == 1, title="1m bull", style=shape.circle, size=size.tiny, color=color.new(color.blue, 0), location=location.bottom)
plotshape(showDebug and sig5 == 1, title="5m bull", style=shape.circle, size=size.tiny, color=color.new(color.aqua, 0), location=location.bottom)
plotshape(showDebug and sig10 == 1, title="10m bull", style=shape.circle, size=size.tiny, color=color.new(color.teal, 0), location=location.bottom)
plotshape(showDebug and sig15 == 1, title="15m bull", style=shape.circle, size=size.tiny, color=color.new(color.navy, 0), location=location.bottom)
plotshape(showDebug and sig1 == -1, title="1m bear", style=shape.circle, size=size.tiny, color=color.new(color.red, 0), location=location.top)
plotshape(showDebug and sig5 == -1, title="5m bear", style=shape.circle, size=size.tiny, color=color.new(color.orange, 0), location=location.top)
plotshape(showDebug and sig10 == -1, title="10m bear", style=shape.circle, size=size.tiny, color=color.new(color.maroon, 0), location=location.top)
plotshape(showDebug and sig15 == -1, title="15m bear", style=shape.circle, size=size.tiny, color=color.new(color.purple, 0), location=location.top)
// ===== Markers (size must be const → gate each size)
off = gateTo15 ? -1 : 0 // when gated, place on the just-closed 15m bar
// ── Marker offset control stays the same ──
off2 = gateTo15 ? -1 : 0
// ── Bullish balls exactly at LOW ──
plot(bullAll and emit and ballSize == "tiny" ? low : na, title="Bullish tiny", style=plot.style_circles, color=bullCol, linewidth=1, offset=off2)
plot(bullAll and emit and ballSize == "small" ? low : na, title="Bullish small", style=plot.style_circles, color=bullCol, linewidth=2, offset=off2)
plot(bullAll and emit and ballSize == "normal" ? low : na, title="Bullish normal", style=plot.style_circles, color=bullCol, linewidth=3, offset=off2)
plot(bullAll and emit and ballSize == "large" ? low : na, title="Bullish large", style=plot.style_circles, color=bullCol, linewidth=4, offset=off2)
plot(bullAll and emit and ballSize == "huge" ? low : na, title="Bullish huge", style=plot.style_circles, color=bullCol, linewidth=5, offset=off2)
// ── Bearish balls exactly at HIGH ──
plot(bearAll and emit and ballSize == "tiny" ? high : na, title="Bearish tiny", style=plot.style_circles, color=bearCol, linewidth=1, offset=off2)
plot(bearAll and emit and ballSize == "small" ? high : na, title="Bearish small", style=plot.style_circles, color=bearCol, linewidth=2, offset=off2)
plot(bearAll and emit and ballSize == "normal" ? high : na, title="Bearish normal", style=plot.style_circles, color=bearCol, linewidth=3, offset=off2)
plot(bearAll and emit and ballSize == "large" ? high : na, title="Bearish large", style=plot.style_circles, color=bearCol, linewidth=4, offset=off2)
plot(bearAll and emit and ballSize == "huge" ? high : na, title="Bearish huge", style=plot.style_circles, color=bearCol, linewidth=5, offset=off2)
// Alerts
alertcondition(bullAll and emit, title="Aligned Bullish Outside (1/5/10/15)", message="Aligned bullish outside bar on 1/5/10/15m")
alertcondition(bearAll and emit, title="Aligned Bearish Outside (1/5/10/15)", message="Aligned bearish outside bar on 1/5/10/15m")
alertcondition((bullAll or bearAll) and emit, title="Aligned Any (1/5/10/15)", message="Aligned outside bar (bull or bear) on 1/5/10/15m")
indicator("Fractal FU", shorttitle="Fractal FU", overlay=true, max_labels_count=500)
// ===== Inputs
showBull = input.bool(true, "Show aligned bullish balls")
showBear = input.bool(true, "Show aligned bearish balls")
bullCol = input.color(color.blue, "Bull ball color")
bearCol = input.color(color.red, "Bear ball color")
ballSize = input.string("small", "Ball size", options=["tiny","small","normal","large","huge"])
gateTo15 = input.bool(true, "Gate to 15m close (clean, fewer signals)")
showDebug = input.bool(false, "Show per-timeframe debug dots")
// ===== Helpers
// one-liner you asked for:
f_sig(res) => request.security(syminfo.tickerid, res, (high > high[1] and low < low[1]) ? (close > open ? 1 : close < open ? -1 : 0) : 0, barmerge.gaps_off, barmerge.lookahead_off)
// Pull confirmed signals from each TF
sig1 = f_sig("1")
sig5 = f_sig("5")
sig10 = f_sig("10")
sig15 = f_sig("15")
// Alignment (all four agree)
bullAll = showBull and (sig1 == 1 and sig5 == 1 and sig10 == 1 and sig15 == 1)
bearAll = showBear and (sig1 == -1 and sig5 == -1 and sig10 == -1 and sig15 == -1)
// Emit control
emit15 = ta.change(time("15"))
emit = gateTo15 ? emit15 : barstate.isconfirmed // if not gated, show wherever alignment is true
// ===== Debug (tiny dots at bar to verify which TFs are firing)
plotshape(showDebug and sig1 == 1, title="1m bull", style=shape.circle, size=size.tiny, color=color.new(color.blue, 0), location=location.bottom)
plotshape(showDebug and sig5 == 1, title="5m bull", style=shape.circle, size=size.tiny, color=color.new(color.aqua, 0), location=location.bottom)
plotshape(showDebug and sig10 == 1, title="10m bull", style=shape.circle, size=size.tiny, color=color.new(color.teal, 0), location=location.bottom)
plotshape(showDebug and sig15 == 1, title="15m bull", style=shape.circle, size=size.tiny, color=color.new(color.navy, 0), location=location.bottom)
plotshape(showDebug and sig1 == -1, title="1m bear", style=shape.circle, size=size.tiny, color=color.new(color.red, 0), location=location.top)
plotshape(showDebug and sig5 == -1, title="5m bear", style=shape.circle, size=size.tiny, color=color.new(color.orange, 0), location=location.top)
plotshape(showDebug and sig10 == -1, title="10m bear", style=shape.circle, size=size.tiny, color=color.new(color.maroon, 0), location=location.top)
plotshape(showDebug and sig15 == -1, title="15m bear", style=shape.circle, size=size.tiny, color=color.new(color.purple, 0), location=location.top)
// ===== Markers (size must be const → gate each size)
off = gateTo15 ? -1 : 0 // when gated, place on the just-closed 15m bar
// ── Marker offset control stays the same ──
off2 = gateTo15 ? -1 : 0
// ── Bullish balls exactly at LOW ──
plot(bullAll and emit and ballSize == "tiny" ? low : na, title="Bullish tiny", style=plot.style_circles, color=bullCol, linewidth=1, offset=off2)
plot(bullAll and emit and ballSize == "small" ? low : na, title="Bullish small", style=plot.style_circles, color=bullCol, linewidth=2, offset=off2)
plot(bullAll and emit and ballSize == "normal" ? low : na, title="Bullish normal", style=plot.style_circles, color=bullCol, linewidth=3, offset=off2)
plot(bullAll and emit and ballSize == "large" ? low : na, title="Bullish large", style=plot.style_circles, color=bullCol, linewidth=4, offset=off2)
plot(bullAll and emit and ballSize == "huge" ? low : na, title="Bullish huge", style=plot.style_circles, color=bullCol, linewidth=5, offset=off2)
// ── Bearish balls exactly at HIGH ──
plot(bearAll and emit and ballSize == "tiny" ? high : na, title="Bearish tiny", style=plot.style_circles, color=bearCol, linewidth=1, offset=off2)
plot(bearAll and emit and ballSize == "small" ? high : na, title="Bearish small", style=plot.style_circles, color=bearCol, linewidth=2, offset=off2)
plot(bearAll and emit and ballSize == "normal" ? high : na, title="Bearish normal", style=plot.style_circles, color=bearCol, linewidth=3, offset=off2)
plot(bearAll and emit and ballSize == "large" ? high : na, title="Bearish large", style=plot.style_circles, color=bearCol, linewidth=4, offset=off2)
plot(bearAll and emit and ballSize == "huge" ? high : na, title="Bearish huge", style=plot.style_circles, color=bearCol, linewidth=5, offset=off2)
// Alerts
alertcondition(bullAll and emit, title="Aligned Bullish Outside (1/5/10/15)", message="Aligned bullish outside bar on 1/5/10/15m")
alertcondition(bearAll and emit, title="Aligned Bearish Outside (1/5/10/15)", message="Aligned bearish outside bar on 1/5/10/15m")
alertcondition((bullAll or bearAll) and emit, title="Aligned Any (1/5/10/15)", message="Aligned outside bar (bull or bear) on 1/5/10/15m")
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.