OPEN-SOURCE SCRIPT
Diupdate

Adil Deger v3.5.2

707
What's New
Multi-method fair value indicator that estimates intrinsic stock price using 10 valuation methods simultaneously, with sector-aware weighting and full BIST + US market support.
Key Features
10 Valuation Methods

Net Earnings P/E (historical average)
ROE-Based
EV/EBIT, EV/EBITDA, EV/Revenue
Forward P/E (uses real analyst consensus when available, falls back to naive annualization)
Forward P/S
P/FCF (Free Cash Flow)
Graham Number
DCF (5-year projection with terminal value, configurable WACC)

Smart Aggregation

Sector Weighted (default) — assigns method weights based on industry (banks favor P/B + ROE, tech favors revenue multiples, utilities favor DCF, etc.)
Median, Trim Mean, Mean alternatives
Confidence indicator (CV across methods) — flags when valuations diverge

Auto Market Detection

Detects BIST vs US automatically from symbol
Picks correct bond benchmark (TR10Y / US10Y) dynamically
Tracks regional inflation (TR / US CPI) with high-inflation warning
Currency-aware

Visual Tools

Bilingual UI (Turkish / English)
Compact info panel: market, rate, inflation, currency, sector, method, forward EPS source, confidence
Discount/Premium bands (configurable threshold) with shaded zones
8-quarter financials table (Net Earnings, Revenue, EBIT, EBITDA, FCF, ROE)

Alerts

Discount opportunity (price crosses below fair value − threshold)
Premium warning (price crosses above fair value + threshold)
Low confidence (method divergence)
New earnings released

Technical

Pine Script v6
Rate floor + cap protection (handles both high-rate emerging markets and low-rate ZIRP environments)
Cash-adjusted Net Debt for accurate EV calculation
Historical rolling average for "normal" multiples (default 252 bars = 1 year)
Robust to missing financial fields (BIST stocks with limited data still work)

Settings Highlights

Language: TR / EN
Market: Auto / BIST / US / Manual
Aggregation Method: Sector Weighted / Median / Trim Mean / Mean
Historical Average Period: configurable (default 252 bars)
DCF: forecast years, equity risk premium, terminal growth, growth cap
Alerts: discount/premium thresholds, low confidence threshold
Catatan Rilis
FIX 1 · sumFirst / avgFirst — na-safe
EN: Skips na quarters instead of propagating na. One missing quarter no longer kills the whole method.
TR: Na olan çeyrekler atlanıyor. Tek eksik veri artık tüm metodu null'a düşürmüyor.
FIX 2 · "Average" mode fallback chain (all 8 normalizers)
EN: Average → Rate → Manual. No more silent na when historical data is insufficient.
TR: Tarihsel veri yoksa Rate'e, o da yoksa Manuel değere düşüyor. Sessiz na üretimi bitti.
FIX 3 · ROE fair price formula
EN: Was producing a price delta, not a fair price. Fixed to PE × ROE × BVPS.
TR: Adil fiyat değil fiyat farkı üretiyordu. PE × ROE × BVPS olarak düzeltildi.
Catatan Rilis
# Adil Değer v3.7.1 — Today's Changes

## 🎯 Major Features

### Auto-Sector Detection
- Automatic sector identification using `syminfo.sector` and `syminfo.industry`
- 8 sector presets with appropriate median multiples (P/E, EV/Rev, EV/EBITDA, P/FCF):
- Tech, Financial, Healthcare, Energy, Utilities, Industrial, Consumer, Other
- Manual override available for custom sector medians

### Pure Forward Auto-Trigger 🚀
- Automatically activates Pure Forward Mode for hyper-growth tech stocks
- Trigger condition: Tech sector + earnings growth ≥ 25% (e.g., NVDA, AMD)
- Visual indicator (🚀 icon) in info panel when auto-triggered

### Outlier Removal in Confidence Score
- Coefficient of Variation now uses trimmed mean
- Removes highest + lowest values before calculating CV
- More robust confidence scores for volatile/hyper-growth stocks

---

## 🐛 Critical Bug Fixes

### Duplicate Quarter Bug
- Fixed duplicate quarterly values caused by `gaps_off` data persistence
- Added composite guard: both quarter key AND value must change before pushing to buffer

### Multiples Showing Empty (P/E, EV/Rev, etc.)
- Root cause: `barmerge.gaps_on` returned `na` on non-quarter-end days
- Switched all 13 `request.financial` calls to `gaps_off`
- Added persistence variables for shares, BVPS, total debt, cash equivalents

### Format String Bug (`-+20%`)
- Replaced Pine Script `"+#.#"` format with custom `f_pctSign()` helper
- Clean negative number display

---

## 📊 Table Restructure

### Single Unified Table (16×8)
- Merged previous 2 tables into 1 horizontal layout
- New column order: `[Label | TTM | NTM | Growth% | 8 Quarters | Multiples Section]`
- Multiples placed side-by-side with metrics for visual alignment
- Removed Mod footer row (info already in info panel)
- Force refresh on each `barstate.islast` to prevent ghost cells

### Growth% Column Repositioning
- Moved next to NTM column for natural reading flow
- Calculation changed from YoY to TTM→NTM ratio (more intuitive)
- Color thresholds relaxed: ≥5% green, ±5% yellow, <-5% red

---

## 🎨 Visual Cleanup (Default Settings)

| Setting | Old Default | New Default | Reason |
|---------|-------------|-------------|--------|
| Label Size | Normal | **Small** | Less visual clutter |
| DCF Forecast Years | 5 | **3** | More conservative projections |
| Discount/Premium Bands | On | **Off** | Cleaner chart |
| Fill Areas | On | **Off** | Removed colored zones |
| Auto-Detect Sector | - | **On** (new) | Smart defaults |
| Auto Pure Forward | - | **On** (new) | Smart defaults |

### Alert System Decoupled from Visuals
- Discount/Premium alerts continue working even when bands are hidden
- New separate calc variables (`discountLevelCalc`, `premiumLevelCalc`)

---

## 📈 Stats

- **Lines of code:** ~1834 → 1610 (282 lines removed)
- **Inputs:** 94 → 63 (31 fewer settings to configure)
- **Total verifications passed:** 15/15
- **Out-of-the-box experience:** Cleaner chart, smarter defaults, sector-aware analysis
Catatan Rilis
Label color is now dynamic — green when undervalued, red when overvalued, yellow when fair, instead of a static color regardless of valuation.

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.