OPEN-SOURCE SCRIPT

Breakout of fractals with alternating signals

345
📌 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.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.