OPEN-SOURCE SCRIPT

BULL-BEAR-WALLDEM

93
Purpose and Overview
Designed for minimalistic charting, this indicator computes RSI (default 14-period on close) but hides all visuals—plots, bands, fills, and smoothing—to focus solely on divergence signals. With overlay=true, it integrates labels onto the main price chart, eliminating separate panes and scale issues. Divergences highlight momentum-price mismatches: bullish for potential upturns (e.g., weakening downtrends), bearish for downturns (e.g., fading rallies). The calculateDivergence input (default false) gates the logic, optimizing for user control and performance.
Technical Implementation

RSI Core: Employs ta.change(), ta.rma() for up/down averages, yielding rsi = 100 - (100 / (1 + up / down)).
Divergence Module: Uses ta.pivotlow()/ta.pivothigh() with fixed lookbacks (left/right: 5) and range filter (5-60 bars). Conditions: Bullish (rsiHL && priceLL), Bearish (rsiLH && priceHH), evaluated conditionally.
Rendering: plotshape() for labels (" Bull "/ " Bear ") at bar extremes (location.belowbar/abovebar), offset by -lookbackRight. Colors: green bull, red bear.
Hiding: color=na for plots/hlines; transparent color.new(..., 100) for fills. Smoothing via switch (SMA/EMA/etc.) but invisible.
Alerts: alertcondition() with pivot context messages.

The structure prioritizes readability: grouped inputs, modular functions, and no unnecessary visuals.
Usage Scenarios and Tips
Apply to trending markets—e.g., 4H BTCUSD for crypto reversals or daily TSLA for stock pullbacks. Enable divergence in settings; labels offset to pivots aid quick scans. Pair with volume or trends for confirmation; alerts enable real-time monitoring. For backtesting, adapt to strategy() using conditions as entry signals.
Customization Options

Inputs: RSI length (min 1), source, divergence toggle (hidden display).
Smoothing: Hidden group with MA types, lengths, BB multipliers.
Extensions: Expose lookbacks as input.int(); add hidden divergences or MTF via request.security().

Limitations and Considerations

Signals rely on data: No divergences mean no labels; adjust parameters for sensitivity.
Repainting possible on live bars; best on closed data.
Not standalone: Divergences (55-65% historical accuracy per studies) need context to avoid false positives in strong trends.
v6-dependent; compatible but feature-limited in v5.

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.