OPEN-SOURCE SCRIPT
TraderDemircan Trend Based Fibonacci + XABCD Formation

Description
TraderDemircan Trend-Based Fibonacci + XABCD Formation is an original open-source indicator that combines trend-based Fibonacci projections with an automated XABC structure detection engine.
The script focuses on identifying swing high → swing low transitions in a downtrend, generating Fibonacci levels and projecting a potential C-target extension based on harmonic geometry.
This indicator is designed for traders who want a clearer visual structure of how retracement, continuation, and harmonic projections interact inside trending markets.
🧩 What the Script Does
1. Detects the Most Recent X–A Swing (Trend High → Trend Low)
The indicator automatically scans a user-defined lookback range to identify:
X: Most recent significant swing high
A: The lowest low after X within the lookback window
This creates the foundational XA leg used for both Fibonacci levels and harmonic projections.
2. Determines a Dynamic B-Point Retracement
The script measures the market’s current retracement relative to the XA leg:
If price retraces below 0.50, B becomes the 0.50 level
If price retraces above 0.50, B becomes the 0.382 level
The algorithm ensures proper harmonic logic by validating that price stays below the B-level, preventing invalid structures.
3. Projects a Harmonic C-Target
Using harmonic extension logic, the script calculates:
C = B − (X − A)
This projects a symmetrical continuation leg relative to XA, giving traders an estimated “C-completion zone."
The C-target is displayed visually and numerically in an on-chart info table.
4. Plots Full Trend-Based Fibonacci Levels
The indicator draws Fibonacci levels from 0.0 to 2.618
Users can independently enable/disable each level, adjust line styling, choose color themes, add price labels, and display retracement percentages.
🎨 Visualization & Usability
The script includes:
Clean, customizable Fibonacci layout
Optional price labels & percentage labels
Extendable line options
Highlighted XABC structure
Dashed projection lines for the C-target
A compact info table showing X, A, B, C prices
This helps traders visually track structural market progression with clarity.
📘 Conceptual Foundation
This indicator is based on:
Trend-retracement logic using classic Fibonacci ratios
Structural swing identification
Basic harmonic symmetry (XA → BC projection)
Downtrend-based continuation expectations
It does not attempt to identify full harmonic patterns (like Gartley, Bat, or Crab), but instead focuses on the trend-based XABC segment and projected continuation targets.
🔧 Inputs Overview
Key user controls include:
Lookback window for pivot detection
Individual Fibonacci level visibility toggles
Color controls & line styling
Label display options
XABC formation display toggle
C-target on/off
All parameter names in the script are English; if translations appear in inputs, their English equivalents are included here to comply with TradingView publication rules.
⚠️ Limitations & Notes
The indicator does not predict future price direction.
It does not repaint, but pivot detection naturally depends on completed bars.
The C-projection is a geometric estimate, not a trading signal.
No forward-looking or non-causal data is used.
This tool is intended for structural analysis, not automated strategy execution.
📎 How to Use It
Add the indicator to a clean chart.
Observe the most recent X → A swing.
Watch how price interacts with 0.382 / 0.5 retracement to form the B-point.
Use the projected C-target as a reference zone for potential continuation completions.
Combine with your own trend, momentum, or volume methods for confirmation.
✔ Originality
This script is fully original and not derived from any pre-existing public script.
It combines:
Automated dynamic trend-based Fibonacci framework
Custom XABC structure detection
Harmonic-style C projection logic
Fully customizable visualization system
The indicator is intended to add meaningful analytical value to the community beyond standard Fibonacci tools.
TraderDemircan Trend-Based Fibonacci + XABCD Formation is an original open-source indicator that combines trend-based Fibonacci projections with an automated XABC structure detection engine.
The script focuses on identifying swing high → swing low transitions in a downtrend, generating Fibonacci levels and projecting a potential C-target extension based on harmonic geometry.
This indicator is designed for traders who want a clearer visual structure of how retracement, continuation, and harmonic projections interact inside trending markets.
🧩 What the Script Does
1. Detects the Most Recent X–A Swing (Trend High → Trend Low)
The indicator automatically scans a user-defined lookback range to identify:
X: Most recent significant swing high
A: The lowest low after X within the lookback window
This creates the foundational XA leg used for both Fibonacci levels and harmonic projections.
2. Determines a Dynamic B-Point Retracement
The script measures the market’s current retracement relative to the XA leg:
If price retraces below 0.50, B becomes the 0.50 level
If price retraces above 0.50, B becomes the 0.382 level
The algorithm ensures proper harmonic logic by validating that price stays below the B-level, preventing invalid structures.
3. Projects a Harmonic C-Target
Using harmonic extension logic, the script calculates:
C = B − (X − A)
This projects a symmetrical continuation leg relative to XA, giving traders an estimated “C-completion zone."
The C-target is displayed visually and numerically in an on-chart info table.
4. Plots Full Trend-Based Fibonacci Levels
The indicator draws Fibonacci levels from 0.0 to 2.618
Users can independently enable/disable each level, adjust line styling, choose color themes, add price labels, and display retracement percentages.
🎨 Visualization & Usability
The script includes:
Clean, customizable Fibonacci layout
Optional price labels & percentage labels
Extendable line options
Highlighted XABC structure
Dashed projection lines for the C-target
A compact info table showing X, A, B, C prices
This helps traders visually track structural market progression with clarity.
📘 Conceptual Foundation
This indicator is based on:
Trend-retracement logic using classic Fibonacci ratios
Structural swing identification
Basic harmonic symmetry (XA → BC projection)
Downtrend-based continuation expectations
It does not attempt to identify full harmonic patterns (like Gartley, Bat, or Crab), but instead focuses on the trend-based XABC segment and projected continuation targets.
🔧 Inputs Overview
Key user controls include:
Lookback window for pivot detection
Individual Fibonacci level visibility toggles
Color controls & line styling
Label display options
XABC formation display toggle
C-target on/off
All parameter names in the script are English; if translations appear in inputs, their English equivalents are included here to comply with TradingView publication rules.
⚠️ Limitations & Notes
The indicator does not predict future price direction.
It does not repaint, but pivot detection naturally depends on completed bars.
The C-projection is a geometric estimate, not a trading signal.
No forward-looking or non-causal data is used.
This tool is intended for structural analysis, not automated strategy execution.
📎 How to Use It
Add the indicator to a clean chart.
Observe the most recent X → A swing.
Watch how price interacts with 0.382 / 0.5 retracement to form the B-point.
Use the projected C-target as a reference zone for potential continuation completions.
Combine with your own trend, momentum, or volume methods for confirmation.
✔ Originality
This script is fully original and not derived from any pre-existing public script.
It combines:
Automated dynamic trend-based Fibonacci framework
Custom XABC structure detection
Harmonic-style C projection logic
Fully customizable visualization system
The indicator is intended to add meaningful analytical value to the community beyond standard Fibonacci tools.
Açık kaynak kodlu komut dosyası
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Feragatname
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Açık kaynak kodlu komut dosyası
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Feragatname
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.