OPEN-SOURCE SCRIPT
Breakout of fractals with alternating signals

📌 Indicator Name: Break of Fractal Body (with Alternating Signals and Extended Lines)
🔍 Purpose:
This indicator detects swing highs and lows (fractals) based on candle body closes, not wicks. It then:
Confirms a breakout when the price closes beyond the body of the fractal.
Alternates signals: a "long" signal only appears after a "short", and vice versa.
Draws a horizontal line from the original fractal bar (where it formed) to the current bar where the breakout happens.
⚙️ Key Features:
✅ Fractals Based on Candle Bodies Only:
A top fractal is where the candle body is higher than len candles on both sides.
A bottom fractal is where the candle body is lower than len candles on both sides.
✅ Breakout Confirmation:
A bullish breakout is when price closes above the last top body fractal.
A bearish breakout is when price closes below the last bottom body fractal.
Breakouts are only recognized if they alternate: you won’t get multiple long/shorts in a row.
✅ Visual Elements:
🔺 Red triangle: Top body fractal.
🔻 Green triangle: Bottom body fractal.
📈 Label BUY: when price breaks a top body fractal.
📉 Label SELL: when price breaks a bottom body fractal.
➖ Horizontal line: drawn from the fractal bar to the breakout bar, showing the exact level of breakout.
✅ Alerts:
Alert when a bullish breakout occurs.
Alert when a bearish breakout occurs.
🔍 Purpose:
This indicator detects swing highs and lows (fractals) based on candle body closes, not wicks. It then:
Confirms a breakout when the price closes beyond the body of the fractal.
Alternates signals: a "long" signal only appears after a "short", and vice versa.
Draws a horizontal line from the original fractal bar (where it formed) to the current bar where the breakout happens.
⚙️ Key Features:
✅ Fractals Based on Candle Bodies Only:
A top fractal is where the candle body is higher than len candles on both sides.
A bottom fractal is where the candle body is lower than len candles on both sides.
✅ Breakout Confirmation:
A bullish breakout is when price closes above the last top body fractal.
A bearish breakout is when price closes below the last bottom body fractal.
Breakouts are only recognized if they alternate: you won’t get multiple long/shorts in a row.
✅ Visual Elements:
🔺 Red triangle: Top body fractal.
🔻 Green triangle: Bottom body fractal.
📈 Label BUY: when price breaks a top body fractal.
📉 Label SELL: when price breaks a bottom body fractal.
➖ Horizontal line: drawn from the fractal bar to the breakout bar, showing the exact level of breakout.
✅ Alerts:
Alert when a bullish breakout occurs.
Alert when a bearish breakout occurs.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。