OPEN-SOURCE SCRIPT

FibNexus [CHE]

244
FibNexus [CHE] — Auto-Fibonacci with Adaptive TrendLen + TFRSI Triggers

What it is.
FibNexus [CHE] is a chart overlay that auto-anchors Fibonacci levels to the most relevant swing range without any manual timeframe picking. It does this by computing an adaptive trend length (“TrendLen”) from recent price behavior, then drawing retracements/extensions from the detected swing High/Low. A built-in TFRSI module adds LONG/SHORT triggers and ready-made alerts.

What makes FibNexus different (the TrendLen edge)

Most Fibonacci tools either (a) use fixed lookbacks or (b) force you to choose a higher reference timeframe (or a multiplier of it) and then place Fibs on those higher-TF swings. Your earlier Ultimate Fibonacci Trading Tool \[CHE] follows that higher-reference approach (auto TF, multiplier, or manual) and emphasizes custom level/label options. ([TradingView][1])

FibNexus flips that workflow:

* It doesn’t rely on a higher timeframe or a static lookback.
* Instead, it measures multiple window lengths inside the current chart timeframe and selects the one that best fits the data right now.
* From that data-driven window, it automatically finds the most recent swing high & low and draws the entire Fib stack from there.
* When the statistically “best” window changes, anchors update once, labels refresh cleanly, and then lines just extend to the right on each new bar.

Result: No more guesswork about “which timeframe or lookback should I use?”—FibNexus adapts the anchors to market conditions and keeps the drawing noise low.

How TrendLen works (transparent, deterministic)

1. Scan windows: The script evaluates a series of lookbacks (10, 20, …, 500 bars).
2. Score by correlation: For each window, it computes the correlation between price and its lagged version and picks the window with the highest correlation (the strongest, most self-consistent trend segment).
3. Anchor the swing: On a confirmed bar and only when TrendLen changes, it scans the last `TrendLen` bars to capture the highest high and lowest low and marks them with “X”.
4. Draw once, extend later: It deletes the old Fib objects, redraws the active levels from those anchors, and from then on extends the lines to the right as new bars print (no redraw spam).

This makes FibNexus responsive (it adapts when the structure shifts) and quiet (it doesn’t constantly repaint Fibs).

Fibonacci engine (levels, labels, direction)

* Retracements: 0.000 · 0.236 · 0.382 · 0.500 · 0.618 · 0.786 · 1.000
* Extensions: 1.618 · 2.618 · 3.618 · 4.236
* Label styles: *Default* (percent + price), *None*, *Percentage*, *Price*
* Label sizing: *tiny → huge*
* Bull/Bear context: Direction is inferred from mid-range positioning; prices are projected accordingly (retracement vs. extension math is handled for both cases).
* Selective toggles: You can show/hide any level and color it independently.

Momentum & signals (TFRSI module)

FibNexus embeds your TFRSI (“The Forbidden RSI \[CHE]”) as the momentum/trigger layer. TFRSI is your open-source oscillator published on TradingView and designed for fast, normalized momentum readouts with customizable length/smoothing. ([TradingView][2])

* Defaults: `TFRSI length = 6`, `signal smoothing = 2`
* Triggers:

* LONG when TFRSI crosses up through the Long level (default 2.0)
* SHORT when TFRSI crosses down through the Short level (default 98.0)
* On-chart labels: Green LONG under the bar, red SHORT above the bar.
* Spam control: Keep only the N most recent labels to avoid clutter.
* Confirmed bars only: Signals/labels finalize at bar close to reduce flicker.

Alerts (ready for TradingView)

* LONG signal (TFRSI crossover)
* SHORT signal (TFRSI crossunder)
* TrendLen changed (anchors/Fibs recalculated)
* Price crossed a Fib level (any active level)

Use the provided `alertcondition(...)` entries in the TV dialog. Optionally enable instant `alert()` calls with verbose text (avoid duplicates if you also add alertconditions).

Typical use-cases & playbook

* Level reaction trading: In trends, watch 0.382 / 0.5 / 0.618 for reaction. A TFRSI up-cross near a retracement in an uptrend is a straightforward continuation setup; the opposite applies in downtrends.
* Breakout objectives: After clearing the 1.000 line (old swing), 1.618 is a common first extension target; beyond that, 2.618/3.618/4.236 map stretch objectives.
* Chop control: In range conditions, keep signals conservative (e.g., stick with the tight defaults 2.0/98.0 or raise thresholds). Always seek confluence (candlesticks, volume, HTF bias).
* Less micromanagement: You don’t need to babysit timeframe selection or anchors—TrendLen recomputes only when the data say so.

Inputs (by group)

* Core: TFRSI length & smoothing.
* Fibonacci Levels: Per-level toggles, numeric values, colors.
* Fibonacci Labels: Style (percentage/price/both/none) and size.
* Signals: Max number of visible LONG/SHORT labels (or 0 = off).
* TFRSI Trigger: Long/Short thresholds (defaults 2.0 / 98.0).
* Alerts: Master enable, per-event toggles, optional instant `alert()`.

Performance & UX

* Overlay indicator; efficient object handling.
* Clean redraw policy: Full re-draw only when TrendLen changes; otherwise Fibs extend horizontally.
* Clarity: Auto-marked swing anchors (“X”), configurable labels/colors.


Credits & references

* TFRSI – “The Forbidden RSI \[CHE]” (open-source publication and description on TradingView). Used here as the momentum basis.
The Forbidden RSI [CHE]

* “Ultimate Fibonacci Trading Tool \[CHE]” (your earlier open-source tool on TradingView). Focuses on higher-reference timeframe selection (auto/multiplier/manual) and rich labeling controls; FibNexus replaces the fixed/higher-TF anchor logic with adaptive TrendLen in the current timeframe.
Ultimate Fibonacci Trading Tool [CHE]



Risk disclaimer

This indicator is for educational/information purposes only and is not financial advice. No performance guarantees; past behavior does not predict future results. Trading involves substantial risk (including total loss). Always do your own research, test on demo, use risk management, and consult a licensed advisor where appropriate. Use at your own risk.

Disclaimer:
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.

Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.

By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.

Enhance your trading precision and confidence with FibNexus [CHE]! 🚀
Happy trading
Chervolino

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.