# IN Analytics Pro v3.4 — The Valuations ++ Bridge, Wired by Default + Display Masters
_Built 02-Aug-2026. Everything defaults ON with layout Full, so updating changes nothing until a switch is touched. No input titles renamed — every saved chart keeps its settings._

## 🔗 The flagship: the Valuations ++ fair-value bridge now ships ON

With Valuations ++ on the same chart, **one pick in the source input** (Fundamental Factors → *External fair value* → the **🔗 Fair Value (bridge export)** plot — the 🔗 plot, not 🎯) hands the engine V++'s composite fair value — percentile bands, consistency-weighted method mix, stationarity gate and the filed-guidance layer behind it — driving the valuation leg of the score, the rating and the projected ROI. **Safe auto-fallback**: an unwired, missing or na source silently reverts to the internal four-method composite, so ON costs nothing on any chart. The **Composite Value row shows 🔗** with its source in the tooltip while the bridge is live. Wire once, save an **Indicator Template** — TradingView carries source links inside templates, so every future chart opens pre-wired. (Pine cannot auto-detect other indicators; the source picker is the only cross-indicator channel — the bridge is designed so that single click is all there is.)

## 🖥️ The Display group

| Master | What it gates |
|---|---|
| **Signal & campaign markers** | Buy/sell/trend/cap/cheat shapes, campaign P1/P2/S1/S2 + trims, exhaustion ✕, S/R break tags, bull-snort dot, sell-risk ⛔️, IPO diamonds — and the invisible signal hover-tooltip anchors that ride on them |
| **Moving averages & level overlays** | The three EMAs, HTF MA pair + trend fill, support/resistance level plots, D/W/M high-low lines |
| **Candle & background paint** | Bull-snort purple / high-volume blue bar colouring, trending/breaking background tint |
| **All tables** | Signal & technicals, risk management, economic/fundamental, market regime |
| **Screen layout** | `Single screen (compact)` forces the Market Regime table into its compact form and hides the 22-row Economic & Fundamental table — the shared-screen answer to tables overflowing across panes when IN runs alongside Valuations ++ (which gained the mirror-image preset in its v6.5). A preset, not auto-detection: Pine cannot measure panes. |

Masters AND-gate on top of every individual toggle — nothing was removed, and the individual switches still work while a master is ON.

Source: `~/IN_Analytics_Pro3_02Aug.pine`. **US ANALYTICS parity pending** — the same patch must be ported before the next US publish.

---

# IN Analytics — IN Analytics Pro v2.3
_A signal-engine rebuild: one-in-one-out discipline, three entry classes, two structural exits, pyramiding Campaign Mode on by default — plus the scoring bugs that were quietly dragging every composite down._

## ⚠️ Behavior changes (read before trusting old signals)

| Change | Old behavior | New behavior | Why it matters |
|---|---|---|---|
| Strict signal alternation | Same-side signals could repeat and cluster — dozens of SELLs through one advance | Exactly one entry and one exit per cycle: no BUY without an intervening SELL, and vice versa | Marker counts on historical charts drop sharply; alerts and Dhan webhooks go back to at-most-one signal per side per cycle |
| Campaign Mode (default ON) | One-in, one-out: full position on the entry, full exit on the sell | Staged position: entry = tranche 1, P1/P2 adds, S1/S2 partial trims, final SELL closes the campaign | The self-backtest books one blended trade per campaign, not one per marker; position sizing is now tiered |
| Two new sell triggers (both ON) | Exits came only from the score model | Blow-off extension and climax-volume bars also force an exit | Positions exit at parabolic tops instead of riding the round trip down; more exits than the old build |
| Two new entry classes (both ON) | Only the valuation-gated score BUY | TREND BUY (stage-2 breakout) and CAP BUY (capitulation reclaim) fire independently of the score | Re-rating rallies and post-flush reversals that the score model structurally could not buy now produce entries |
| Inverse-asset detection tightened | A mildly negative beta was enough — ordinary smallcaps got the "Defensive/Inverse Asset" banner and inverted buy/sell thresholds | Automatic detection needs genuinely negative correlation **and** negative beta | Ordinary equities stop generating inverted SELL pressure through uptrends; real inverse assets are unaffected |
| Elliott wave module | Could never confirm a valid retracement and had no way out of a stuck state — a permanent bearish drag on the composite | Correct retracement band and math, plus a 100-bar timeout back to neutral | Composite and combined scores shift **upward** on trending charts versus historical readings |
| Missing fundamental data | Absent cash-flow data scored as "terrible cash conversion" and could trip the fraud penalty; the valuation weight always diluted the denominator | Missing data is treated as missing on both counts | Fundamental scores rise for data-poor names; the quality table shows "N/A" instead of "NaN%" |
| Self-backtest pricing | Booked at the signal bar's open — unknowable when a close-based signal fires | Booked at the close, with an optional slippage haircut | Win rate and average PnL are honestly lower than the old numbers |
| Backtest win rate | Integer division truncated it to 0% or 100% | Real percentages | The "Model Backtest" cell was effectively meaningless before |
| TD Sequential contribution | Latched for weeks after the setup ended | Decays after ~10 bars, clears when counts reset, and shows its age | Stale ±3-weighted TD values no longer sit in the composite |
| Exchange-rate leg | Thresholds were 100× too small — the signal flipped on FX noise and carried half the monetary score | Correct percent-scale thresholds | The exchange signal sits neutral far more often; monetary score shifts toward neutral vs history |
| Macro windows on weekly/monthly charts | A fixed 60-bar lookback meant 60 *weeks* (~14 months) on a weekly chart | Window scales with the chart timeframe (~60 calendar days) | Economic score and the regime label genuinely differ on weekly passes; daily charts are unchanged |
| Higher-timeframe moving averages | Averaged chart bars of a stepped HTF series | True EMAs computed inside the higher-timeframe context | HTF alignment and signal confidence read differently |
| Macro inputs slimmed | US CPI and US GDP fed small legs into the India macro score | Those two legs removed; the India legs keep their weights | Borderline regime classifications can flip |
| Webhook JSON | Fired only on score BUY/SELL | Fires on all eight events and carries `type`, `confidence`, plus `fraction` and (on sells) `entry_class` while Campaign Mode is on | Any consumer keying only off `action` is unaffected, but it must be idempotent about the new event types |

## 🐛 Fixes

- **Elliott wave engine** — the wave check compared a percentage retracement against a 0.1 threshold (so it only "passed" when the pivot sat above the wave high) and the state machine had no exit → correct 23.6–78.6 retracement band, absolute-value denominators on both impulse and corrective legs, and a 100-bar timeout that resets the state to neutral.
- **Inverse-asset misfire** — a smallcap's high volatility could push its beta below the trigger even with near-zero correlation, flagging it as an inverse asset and inverting every threshold → automatic detection now requires real negative correlation *and* negative beta.
- **Missing cash-flow data penalised** — an absent CFO/net-income figure was scored as a terrible cash-conversion reading and could trigger the fraud penalty → missing is now genuinely missing, and the table cell shows "N/A" instead of "NaN%".
- **Fair-value weighting always diluted** — the valuation leg entered the denominator even when no method produced a fair value → it now counts only when at least one method worked.
- **Backtest win rate stuck at 0% or 100%** — integer division → real percentages.
- **Backtest priced at the wrong bar** — entries and exits were booked at the signal bar's open → now at the close, matching the alert payload.
- **Stale TD Sequential readings** — the TD signal was set but never reset, holding weeks-old values → decays after ~10 bars and clears when the counts are zero.
- **Exchange-rate thresholds 100× too small** — percent-scale deviations were compared against 0.02/0.01 → 2.0/1.0.
- **Fraud filter toggle ignored** — operator precedence let the first branch fire even with the filter switched off → the toggle now gates both branches.
- **Inverse-asset detection self-cancelling** — the sector test overwrote the manual override and keyword detection → the tests now combine, and the banner names which one fired.
- **Gold keyword over-matched** — any ticker containing "GOLD" was caught, including ordinary jewellery equities → gold ETFs and futures still match, equities no longer do.
- **Higher-timeframe MAs weren't** — the 8/21 EMAs averaged chart bars of a stepped weekly series → computed inside the higher-timeframe context.
- **Weekly/monthly macro windows** — a hardcoded 60-bar lookback became 60 weeks on a weekly chart → the window now scales with the timeframe and is capped so it can't outrun the history buffer.
- **Gold weekly feed drifted intra-week** — now reads the confirmed prior week; historical values are identical, only live drift is gone.
- **"Stable Value" for companies with no earnings data** — a missing EPS estimate was read as zero earnings volatility → those names now classify as Undefined and get default valuation weights.
- **Normalization lookback could exceed the script's history buffer** — now clamped, with the clamp documented in the input tooltip.
- **Stale entry prices** — a blocked or repeated signal could re-stamp the entry anchor and corrupt the next trade's PnL → every stamp is gated by the position state.

## ✨ New features

**TREND BUY (stage-2 breakout)** — a valuation-blind structural entry for re-rating rallies the score model can't buy, because a run above stale fair value lifts its own threshold out of reach.
· **Inputs:** `TREND BUY (stage-2 breakout)` (ON) — master toggle · `Breakout base lookback (bars)` (50) — the base high the close must clear · `Breakout volume multiple (× 20-bar avg)` (1.5) — minimum volume expansion on the breakout bar. Also requires price above a rising long-term MA, positive Mansfield relative strength vs your chosen benchmark, and no active blow-off extension.
· **What you'll see:** a lime "TREND BUY" triangle below the breakout bar.

**CAP BUY (capitulation reclaim)** — buys the reversal after a flush, never the flush itself.
· **Inputs:** `Capitulation BUY` (ON) · `ATR flush multiple` (4.5) — the climax bar's low must be this many ATRs below the reference EMA · `Volume spike multiple (× 20-bar avg)` (3.0) · `Reclaim window (bars)` (3) — bars allowed for the reclaim after the climax · `Aggressive mode` (OFF) — when off, no capitulation buys while price is under a falling long-term MA.
· **What you'll see:** a teal "CAP BUY" triangle 1–3 bars *after* the flush bar, on the bar that closes back above the flush bar's midpoint.

**ATR Extension Sell (sell factor A)** — exits parabolic blow-offs.
· **Inputs:** `ATR Extension Sell (factor A)` (ON) · `ATR extension multiple` (5.0, typical 4–7, up to 10 for high-momentum names) · `Extension reference MA length (EMA)` (21).
· **What you'll see:** a SELL when the close stretches more than 5 ATRs above the 21 EMA — and, while flat, the info table reads "Sell" so a fresh buy can't chase the same parabola.

**Volume Stop Sell (sell factor B)** — classic stopping-volume / distribution exit.
· **Inputs:** `Volume Stop Sell (factor B)` (ON) · `Volume spike multiple (× 20-bar avg)` (3.0).
· **What you'll see:** a SELL on a huge-volume bar that closes in the lower half of its range after an advance, or on a spike-and-fail reversal bar.

**Campaign Mode (pyramiding tiers)** — position-level pyramiding per the house doctrine: adds are half the initial size, earned at roughly +1R, maximum two adds, never below entry.
· **Inputs:** `Enable Campaign Mode` (ON) · `Tranche 1 % (initial BUY / CAP BUY)` (50) · `Tranche 2 % (P1 add)` (25) · `Tranche 3 % (P2 add)` (25) · `Earn-the-add: min open gain (ATRs)` (1.5) — an add needs this much open gain above the last tranche's entry.
· **What you'll see:** small green "P1"/"P2" triangles on adds; small orange "S1" (extension trim) and "S2" (volume-stop trim) triangles on partial exits; the final SELL closes the campaign, and the Model Backtest row counts the whole campaign as one blended trade.

**Entry-class exit labels** — the exit now tells you which entry it is closing.
· **What you'll see:** red "SELL" for score entries, orange-red "TREND SELL" for a campaign opened by TREND BUY, deep-red "CAP SELL" for one opened by CAP BUY. Exactly one label per exit.

**Alert and webhook upgrades** — eight alert conditions: BUY, TREND BUY, CAP BUY, SELL, and campaign P1 ADD / P2 ADD / S1 TRIM / S2 TRIM.
· **What you'll see:** the webhook JSON now carries `type` on every emission (`buy`/`trend_buy`/`cap_buy`/`sell`/`p1`/`p2`/`s1`/`s2`), `confidence`, plus `fraction` (the tranche % involved) and `entry_class` on sells whenever Campaign Mode is on.

**Backtest slippage** — `Backtest slippage (bps per side)` (0.0). Applies an adverse fill to every tracked entry and exit; at the default of 0 nothing changes.

**Reset signal state** — `Reset signal state` (OFF). Tick once to force the alternation machine back to flat after a manual exit, then untick.

**Inverse-asset reason** — the orange banner now reads "Defensive/Inverse Asset Detected (…)" naming what triggered it: manual override, ticker keyword, defensive sector, negative correlation, or negative beta.

**TD age tag** — the TD Seq row appends "· n bars ago" whenever the reading isn't from the current bar.

## ⚙️ Changed defaults

| Input | Old | New | Effect |
|---|---|---|---|
| `Enable Campaign Mode` | n/a — new (built OFF, shipped ON) | **ON** | P1/P2 adds and S1/S2 partial trims are live out of the box; the backtest books one blended trade per campaign |
| `TREND BUY (stage-2 breakout)` | n/a — new | ON | lime breakout entries fire independently of valuation |
| `Capitulation BUY` | n/a — new | ON | teal reclaim entries fire after flushes |
| `Aggressive mode` (CAP BUY) | n/a — new | OFF | no capitulation buys under a falling long-term MA |
| `ATR Extension Sell (factor A)` | n/a — new | ON | adds blow-off exits |
| `Volume Stop Sell (factor B)` | n/a — new | ON | adds climax-volume exits |
| `Earn-the-add: min open gain (ATRs)` | n/a — new | 1.5 | adds must show ~1R of open gain |
| `Backtest slippage (bps per side)` | n/a — new | 0.0 | stats unchanged until you raise it |
| `Reset signal state` | n/a — new | OFF | inert until ticked |

**Saved chart instances:** TradingView keys saved inputs by title, so every chart copy you already have keeps its stored values for inputs whose titles existed before — `Enable Probable Fraud filter`, `Confirm signals on bar close`, `Use Normalized Scoring (v4)`, `RS / Correlation Benchmark` and the rest are untouched. Every input in the table above is **new**, so no saved instance has a stored value for it: old and new chart copies alike pick up these defaults, including Campaign Mode ON. No existing input was renamed, precisely so nothing silently resets.

Internal thresholds also changed (not user inputs): the Elliott retracement band (0.1 → 23.6–78.6), the exchange-rate signal thresholds (0.02/0.01 → 2.0/1.0), and the macro change window (fixed 60 bars → timeframe-scaled).

## 🧪 Test plan (before publishing)

Reference symbol: **NSE:INDSWFTLAB, daily** — a +130% re-rating with a 2025 capitulation, and the chart that surfaced the hotfix wave.

1. **Alternation.** Scan the full visible history on INDSWFTLAB. *Pass:* every entry marker (BUY / TREND BUY / CAP BUY) is followed by exactly one exit label before the next entry of any class — zero instances of two entries or two exits in a row anywhere on the chart.
2. **TREND BUY fires where expected.** During the ₹124→237 advance. *Pass:* at least one lime "TREND BUY" triangle sits on a bar whose close crosses above the highest high of the prior 50 bars, on volume ≥ 1.5× the 20-bar average, with price above a rising long-term MA.
3. **CAP BUY fires where expected.** At the 2025 capitulation. *Pass:* a teal "CAP BUY" triangle appears within 3 bars *after* a bar whose low is ≥ 4.5 ATRs below the 21 EMA on ≥ 3× average volume — and never on the flush bar itself.
4. **CAP BUY stage guard.** Leave `Aggressive mode` OFF. *Pass:* no CAP BUY prints while price is below a falling long-term MA. Tick it on: at least one extra CAP BUY appears in a Stage-4 stretch. Untick to restore.
5. **Sell factor A.** Find a bar where close exceeds the 21 EMA by more than 5 ATRs while a position is open. *Pass:* a SELL prints there. Untick `ATR Extension Sell (factor A)`: *Pass:* that SELL disappears and the position runs on to the next model exit.
6. **Sell factor B.** Find a bar with volume ≥ 3× the 20-bar average closing in the lower half of its range after an advance. *Pass:* a SELL prints. Untick `Volume Stop Sell (factor B)`: *Pass:* it disappears.
7. **Partial-exit labels.** With Campaign Mode ON and at least two tranches open, re-run the factor-A/B conditions. *Pass:* a small orange "S1" (extension) or "S2" (volume stop) triangle prints instead of a full SELL, at most one per bar, and a multi-bar extension trims only once — the last remaining tranche always exits via a full SELL, never a trim.
8. **Adds are earned.** *Pass:* every green "P1"/"P2" triangle sits above the previous tranche's entry price, above the 21 EMA, and at least 1.5 ATRs above that entry. Set `Earn-the-add` to 0 → more P1/P2 markers appear; set it back to 1.5 → they revert exactly.
9. **Campaign accounting.** Read the "Model Backtest" cell. *Pass:* the trade count `n` equals the number of completed BUY→SELL campaigns visible, not the number of entry markers — a campaign with two adds and one trim still counts as one trade, and the win rate is some value other than 0% or 100%.
10. **Exit labels by entry class.** *Pass:* a campaign opened by TREND BUY closes with an orange-red "TREND SELL"; one opened by CAP BUY closes with a deep-red "CAP SELL"; a score entry closes with the standard red "SELL". Exactly one sell label per exit bar.
11. **Inverse-asset banner absent on ordinary stocks.** *Pass:* no orange "Defensive/Inverse Asset Detected" banner on INDSWFTLAB, on a large-cap such as NSE:RELIANCE, or on NSE:GOLDIAM (a jewellery equity, previously caught by the GOLD keyword). *Pass:* the banner **does** still appear, with a reason in brackets, on NSE:GOLDBEES and on MCX gold futures.
12. **Campaign Mode off restores classic behavior.** Untick `Enable Campaign Mode`. *Pass:* all P1/P2/S1/S2 markers vanish, every exit renders as the plain red "SELL", and each cycle is exactly one entry and one exit.
13. **Each new entry class off restores prior behavior.** Untick `TREND BUY`, then `Capitulation BUY`. *Pass:* the lime and teal triangles disappear respectively and no other marker moves.
14. **Alerts and webhook payload.** Create all eight alert conditions and let one fire. *Pass:* the JSON contains a `type` field matching the event, a `confidence` value, a `fraction` field while Campaign Mode is on, and — on a sell — an `entry_class` naming the class that opened the campaign.
15. **Reset hatch.** Tick `Reset signal state` for one bar, then untick. *Pass:* the machine returns to flat and the next entry of any class can fire immediately.
16. **TD age tag.** *Pass:* the TD Seq row shows "· n bars ago" when the reading is stale, and shows no tag on a bar where a TD label prints on the chart.

## 📋 Publishing blurb (paste into TradingView release notes)

Signals now alternate strictly: one entry, one exit, no clusters.

Two new entry classes — TREND BUY catches stage-2 breakouts that the valuation-gated model used to miss, and CAP BUY buys the reclaim after a capitulation flush (never the flush itself).

Two new structural exits — an ATR-extension sell for parabolic blow-offs and a stopping-volume sell for climax distribution bars.

Campaign Mode is now on by default: the entry opens tranche 1, P1/P2 adds are earned with ~1R of open gain, and S1/S2 trim partial tranches instead of dumping the whole position.

Exits are labelled by the entry that opened them: SELL, TREND SELL or CAP SELL.

Eight alert conditions, and the webhook payload now carries the event type, confidence, tranche fraction and entry class.

Fixed: the Elliott wave module was stuck in a permanent bearish state and dragging every composite score down.

Fixed: companies with missing cash-flow or earnings data were being scored as if the data were bad rather than absent.

Fixed: ordinary stocks were sometimes flagged as inverse/defensive assets, which silently inverted their buy and sell thresholds.

Fixed: the backtest booked trades at the wrong price and its win rate could only ever read 0% or 100%.

Fixed: TD Sequential readings latched for weeks, exchange-rate signals flipped on noise, and macro windows on weekly charts covered 14 months instead of two.

Recommended: re-validate any alert thresholds against replay before comparing new readings with old ones.

---

# US Analytics — US ANALYTICS

_The India-sibling fix set finally ported, a valuation engine that stops fighting itself, and the same one-in-one-out signal machine with three entry classes, two structural exits and Campaign Mode._

## ⚠️ Behavior changes (read before trusting old signals)

| Change | Old behavior | New behavior | Why it matters |
|---|---|---|---|
| Strict signal alternation | The old latch allowed a first-signal SELL and repeated same-side prints | Starts flat: the first print is always a BUY, and every SELL requires an open BUY | Historical marker counts fall and backtest trades are segmented into complete round trips |
| Campaign Mode (default ON) | One-in, one-out | Entry = tranche 1, P1/P2 adds, S1/S2 partial trims, final SELL closes the campaign | The backtest books one blended trade per campaign; position sizing is tiered |
| Two new sell triggers (both ON) | Exits came only from the score model | Blow-off extension and climax-volume bars also force an exit | Exits at parabolic tops instead of round trips; more exits than before |
| Two new entry classes (both ON) | Only the valuation-gated score BUY | TREND BUY (stage-2 breakout) and CAP BUY (capitulation reclaim) fire independently of the score | Stage-2 rallies and post-crash reversals now produce entries |
| Fair value recalculated | The EBITDA estimate subtracted interest and tax instead of adding them back, and the P/S leg was circular — it collapsed to roughly the current price | Sign corrected; the circular P/S leg is disabled and the remaining legs renormalize | Composite fair value, projected ROI, valuation rating and long-term valuation impulses all move materially on most symbols |
| Quality gate is live for the first time | The easing/penalty tests compared against strings the engine never emitted, so quality never adjusted thresholds | Strings aligned | High-quality names get eased buy thresholds; weak ones get harder buys and easier sells — expect more buys on quality, earlier exits on junk |
| Moderate regime tiers are live | A "Moderately"/"Moderate" string mismatch meant moderate regimes never adjusted anything | Fixed | Moderate expansionary/contractionary regimes now shift thresholds as designed |
| Elliott wave module | Permanent bearish latch, same deadlock as the India sibling | Correct retracement band and a 100-bar staleness reset | Composite scores rise on long-history charts that had a stalled wave state |
| Macro score could kill all signals | A young chart or one failed macro symbol NaN'd the composite — no signals ever, NaN table | Missing legs contribute zero | Symbols that produced nothing at all now produce signals |
| Exchange leg and trend weight wired in | The exchange weight and its Dollar-Sensitive boost fed nothing; the trend weight was hardcoded | Both feed the composite through named weights | Composite shifts by roughly ±0.5, up to ±2.5 in the Dollar-Sensitive regime |
| Index/ETF penalty removed | Indices and ETFs took a blanket −15 for trading below their 200 EMA | The penalty is restricted to actual stocks | Index charts score materially higher in downtrends — buy signals are possible where none could fire |
| New Risk-Off regime | Volatile, thin-breadth markets fell into High Volatility / Choppy | A dedicated Risk-Off regime when VIX ≥ 25 and S&P breadth < 40 | Buy thresholds ×1.4, sell thresholds ×0.8, and a different weight mix in those conditions |
| "FII Sensitive" renamed "Dollar Sensitive" | India-derived regime name and advice text ("Monitor USD/INR", "FII holdings") | US-appropriate name, regime row and advice | Trigger, weights and thresholds are unchanged, but any alert or screenshot keyed on the old string no longer matches |
| Defensive-sector detection | Sector names never matched TradingView's taxonomy and the correlation test had the wrong sign, so only Utilities ever fired — and the sector test overwrote the manual override | Correct sectors, correct sign, override preserved | Staples/healthcare names with genuinely inverse correlation now flip to inverse-asset threshold logic |
| Higher-timeframe trend | Stepped for one chart bar per HTF period and flipped intrabar with the developing bar | Derived from confirmed HTF closes | HTF alignment and signal confidence stop flickering; historical values differ from before |
| Backtest pricing | Booked at the signal bar's open | Booked at the close | Win rate and average PnL are honestly lower |
| Weekly/monthly charts | Macro deltas and P/E-history sampling used 60 chart bars — 60 weeks on a weekly chart | Both normalized to ~60 trading days on every timeframe | Economic score and median P/E change on non-daily charts; daily is unchanged |

## 🐛 Fixes

- **EBITDA estimate sign error** — interest and tax were subtracted from net income instead of added back, understating every EV-based fair value → corrected.
- **P/S fair value was circular** — forward revenue per share × forward P/S collapses to roughly the current price by identity, dragging the composite toward the market → the leg is disabled and P/E and EV/EBITDA renormalize cleanly.
- **Macro score could NaN out every signal** — a young chart or one failed macro symbol poisoned the composite so nothing ever fired → missing legs now contribute zero.
- **Quality gate never matched** — the easing and penalty branches tested for strings the engine never produces, so quality-based threshold adjustment was dead code → strings aligned on both the engine and the display table.
- **Moderate regime tiers never adjusted thresholds** — a "Moderately" vs "Moderate" mismatch → fixed at both consumer sites.
- **Elliott wave engine** — the same deadlock as the India sibling: an inverted retracement test and no state timeout → correct 23.6–78.6 band, absolute-value denominators, and a reset after 100 bars without a wave event.
- **Gold score compared dollars against percent thresholds** — saturated at ±2 on week boundaries and 0 elsewhere → percent change with a zero guard.
- **Weekly/monthly EMA switch was dead code** — the timeframe-adaptive assignments created local shadows, so weekly-and-above charts fell back to an empty 200 EMA → they now use the intended 10/20/40 set.
- **Stale TD Sequential** — the counts reset but the signal never did → TD contribution is event-scoped again.
- **Backtest priced at the wrong bar** — entries and exits booked at the signal bar's open → now at the close.
- **Fraud filter toggle ignored** — operator precedence let the first branch fire regardless of the toggle → fully gated.
- **Blanket −15 penalty on indices and ETFs** — a below-200-EMA penalty that dwarfed every sub-model → restricted to actual stocks, with an explicit guard for young charts.
- **Exchange weight fed nothing** — the exchange signal and its regime boost adjusted a weight that never reached the composite → wired in; the hardcoded trend weight is now a named weight of the same value.
- **Fair-value weighting always diluted** — the valuation leg entered the denominator even with no valuation data → it now joins only when a fair value actually exists.
- **Defensive-sector detection never fired** — the sector names weren't TradingView's, the correlation test looked for weak *positive* correlation instead of inverse, and the branch stomped the manual override → all three corrected.
- **Orphaned risk lines** — stop and target lines persisted after a Buy→Sell flip or after switching the display off → the inactive side is cleared every bar.
- **Spread change showed "NaN %"** — a value was being passed where a lookback length was expected → manual, guarded percent change; the table shows "N/A" when there's no data.
- **Elliott table label was stale** — seven label assignments created local shadows → the cell now shows the true latest wave.
- **Higher-timeframe trend flipped intrabar** — it stepped once per HTF period then flickered with the developing bar → derived from confirmed HTF closes.
- **Daily/weekly/monthly levels overwrote each other** — the three level blocks shared one set of line handles, so only the last enabled timeframe drew → separate handles per timeframe, and the period-open line (created but never positioned) is now drawn in yellow.
- **Macro and P/E windows not timeframe-normalized** — 60 chart bars meant 60 weeks on a weekly chart, starving the P/E median → both use a ~60-trading-day window on every timeframe.

## ✨ New features

**TREND BUY (stage-2 breakout)** — a valuation-blind structural entry for the rallies the score model can't buy once a run above stale fair value lifts its own threshold.
· **Inputs:** `TREND BUY (stage-2 breakout)` (ON) · `Breakout base lookback (bars)` (50) — the prior-bar high the close must clear · `Breakout volume multiple (× 20-bar avg)` (1.5). Also requires price above a rising long-term MA, relative strength versus the S&P rising over the base, and no active blow-off extension.
· **What you'll see:** a lime "TREND BUY" triangle below the breakout bar.

**CAP BUY (capitulation reclaim)** — buys the reversal after a flush, never the flush itself.
· **Inputs:** `Capitulation BUY` (ON) · `ATR flush multiple` (4.5) · `Volume spike multiple (× 20-bar avg)` (3.0) · `Reclaim window (bars)` (3) · `Aggressive mode` (OFF) — when off, no capitulation buys while price is under a falling long-term MA.
· **What you'll see:** a teal "CAP BUY" triangle 1–3 bars after the flush, on the bar that closes back above the flush bar's midpoint.

**ATR Extension Sell (sell factor A)** — exits parabolic blow-offs.
· **Inputs:** `ATR Extension Sell (factor A)` (ON) · `ATR extension multiple` (5.0) · `Extension reference MA length (EMA)` (21).
· **What you'll see:** a SELL when the close stretches more than 5 ATRs above the 21 EMA; while flat, the Model Score cell reads the pinned value so a fresh buy can't chase the same parabola.

**Volume Stop Sell (sell factor B)** — classic stopping-volume exit.
· **Inputs:** `Volume Stop Sell (factor B)` (ON) · `Volume spike multiple (× 20-bar avg)` (3.0).
· **What you'll see:** a SELL on a huge-volume bar closing in the lower half of its range after an advance, or on a spike-and-fail reversal bar.

**Campaign Mode (pyramiding tiers)** — adds are half the initial size, earned at roughly +1R, maximum two adds, never below entry.
· **Inputs:** `Enable Campaign Mode (pyramiding tiers)` (ON) · `Tranche 1 size (%)` (50) · `Tranche 2 size (%)` (25) · `Tranche 3 size (%)` (25) — normalized to their sum · `Earn-the-add: min open gain (ATRs)` (1.5).
· **What you'll see:** small green "P1"/"P2" triangles on adds; small orange "S1" (first trim of the campaign) and "S2" (second trim) triangles on partial exits; one blended trade per campaign in the backtest row. Visual and backtest only — this script has no alerts or webhooks.

**Entry-class exit labels** — red "SELL" for score entries, orange-red "TREND SELL" for a campaign opened by TREND BUY, deep-red "CAP SELL" for one opened by CAP BUY. Exactly one label per exit.

**Risk-Off regime** — automatic, no input: triggers when VIX ≥ 25 and S&P 500 breadth (percent above 200-day) is below 40, and outranks every regime except Strong Downtrend and Recession Warning.
· **What you'll see:** a burnt-orange regime row with its own advice text; buy thresholds ×1.4, sell thresholds ×0.8, higher weight on relative volume and monetary factors.

**Model Backtest row** — a new table row reading `NN% W · avg N.N% · nNN`: win rate, average PnL per closed model signal and the trade count over the visible history.

**Confirm on close** — `Confirm on close` (OFF, Signal Filters group). When on, buy and sell signals only change on confirmed bars — no intrabar repainting. Default off preserves the previous behavior exactly.

**Reset signal state** — `Reset signal state` (OFF). Tick once to force the alternation machine flat after a manual exit, then untick.

## ⚙️ Changed defaults

| Input | Old | New | Effect |
|---|---|---|---|
| `Enable Campaign Mode (pyramiding tiers)` | n/a — new (built OFF, shipped ON) | **ON** | P1/P2 adds and S1/S2 partial trims are live out of the box; one blended trade per campaign in the backtest |
| `TREND BUY (stage-2 breakout)` | n/a — new | ON | lime breakout entries fire independently of valuation |
| `Capitulation BUY` | n/a — new | ON | teal reclaim entries fire after flushes |
| `Aggressive mode` (CAP BUY) | n/a — new | OFF | no capitulation buys under a falling long-term MA |
| `ATR Extension Sell (factor A)` | n/a — new | ON | adds blow-off exits |
| `Volume Stop Sell (factor B)` | n/a — new | ON | adds climax-volume exits |
| `Earn-the-add: min open gain (ATRs)` | n/a — new | 1.5 | adds must show ~1R of open gain |
| `Confirm on close` | n/a — new | OFF | previous (repainting) behavior preserved until you switch it on |
| `Reset signal state` | n/a — new | OFF | inert until ticked |

**Saved chart instances:** TradingView keys saved inputs by title, so every chart copy you already have keeps its stored values for inputs whose titles existed before — `Enable Probable Fraud filter`, `Track PnL Mode`, `Manual Override for Inverse Asset` and the rest are untouched. All the inputs above are **new**, so no saved instance has a stored value for them: old and new chart copies alike pick up these defaults, including Campaign Mode ON. No existing input was renamed.

Internal changes with no input attached: the P/S fair-value leg is zeroed, the Elliott retracement band moves from 0.1 to 23.6–78.6, the macro and P/E-history windows become timeframe-normalized, and the "FII Sensitive" regime string becomes "Dollar Sensitive".

## 🧪 Test plan (before publishing)

Reference symbols: **NASDAQ:AAPL, daily** (liquid large-cap, clean baseline) and **NASDAQ:META, daily** (the 2022 drawdown and capitulation, then the 2023 stage-2 re-rating). **NASDAQ:NVDA** is useful for the extension exit.

1. **Alternation.** Scan the full history on AAPL and META. *Pass:* the first print on each chart is an entry, never a SELL; every entry marker is followed by exactly one exit label before the next entry of any class — no two entries or two exits in a row.
2. **TREND BUY fires where expected.** META through the 2023 recovery. *Pass:* at least one lime "TREND BUY" triangle on a bar whose close crosses above the highest high of the prior 50 bars, on volume ≥ 1.5× the 20-bar average, with price above a rising long-term MA.
3. **CAP BUY fires where expected.** META at the late-2022 low. *Pass:* a teal "CAP BUY" triangle within 3 bars *after* a bar whose low is ≥ 4.5 ATRs below the 21 EMA on ≥ 3× average volume — never on the flush bar itself.
4. **CAP BUY stage guard.** Leave `Aggressive mode` OFF. *Pass:* no CAP BUY prints during the 2022 decline while price is below a falling long-term MA. Tick it on: at least one extra CAP BUY appears in that stretch. Untick to restore.
5. **Sell factor A.** NVDA, or any bar where close exceeds the 21 EMA by more than 5 ATRs while a position is open. *Pass:* a SELL prints there. Untick `ATR Extension Sell (factor A)`: *Pass:* that SELL disappears and the position runs on.
6. **Sell factor B.** Find a bar with volume ≥ 3× the 20-bar average closing in the lower half of its range after an advance. *Pass:* a SELL prints. Untick `Volume Stop Sell (factor B)`: *Pass:* it disappears.
7. **Partial-exit labels.** With Campaign Mode ON and at least two tranches open, re-run the factor-A/B conditions. *Pass:* a small orange "S1" (first trim) or "S2" (second trim) triangle prints instead of a full SELL, and the core tranche is never trimmed — a single remaining tranche always exits via a full SELL.
8. **Adds are earned.** *Pass:* every green "P1"/"P2" triangle sits above the previous tranche's entry, above the 21 EMA, and at least 1.5 ATRs above that entry, and only after the score dipped below the buy threshold and re-crossed it. Set `Earn-the-add` to 0 → more P1/P2 markers; back to 1.5 → they revert exactly.
9. **Campaign accounting.** Read the "Model Backtest" cell. *Pass:* the trade count `n` equals the number of completed campaigns visible, not the number of markers — a campaign with two adds and one trim counts as one trade, and the win rate reads a real percentage.
10. **Exit labels by entry class.** *Pass:* a campaign opened by TREND BUY closes with an orange-red "TREND SELL"; one opened by CAP BUY closes with a deep-red "CAP SELL"; a score entry closes with the standard red "SELL". Exactly one sell label per exit bar.
11. **Inverse-asset banner absent on ordinary stocks.** *Pass:* no orange "Defensive/Inverse Asset Detected" banner on AAPL, META, or on defensive-sector names such as NYSE:JNJ and NYSE:PG (which the corrected sector taxonomy now matches, but which fail the inverse-correlation test). *Pass:* it does appear on a genuinely inverse instrument such as AMEX:GLD or a short/inverse ETF.
12. **Campaign Mode off restores classic behavior.** Untick `Enable Campaign Mode`. *Pass:* all P1/P2/S1/S2 markers vanish, every exit renders as the plain red "SELL", and each cycle is one entry and one exit.
13. **Each new entry class off restores prior behavior.** Untick `TREND BUY`, then `Capitulation BUY`. *Pass:* the lime and teal triangles disappear respectively and no other marker moves.
14. **Confirm on close.** Switch `Confirm on close` on during live hours. *Pass:* the BUY/SELL state stops changing mid-bar and only updates when the bar closes. Switch it off: *Pass:* prior intrabar behavior returns.
15. **Risk-Off regime.** Use bar replay to a VIX ≥ 25, thin-breadth window (October 2022 or March 2020). *Pass:* the regime row reads "Risk-Off" in burnt orange and the displayed buy/sell thresholds are ×1.4 / ×0.8 versus a neutral-regime bar on the same symbol.
16. **Index sanity.** Load AMEX:SPY or a sector ETF in a downtrend. *Pass:* the score is no longer crushed by a flat −15 penalty, and the table shows no "NaN" cells.
17. **Weekly timeframe.** Switch AAPL to weekly. *Pass:* the moving-average set switches to the 10/20/40 configuration (no empty 200 EMA), the economic score is populated, and the daily/weekly/monthly level lines all render simultaneously rather than only the last enabled one.

## 📋 Publishing blurb (paste into TradingView release notes)

Signals now alternate strictly: one entry, one exit, no clusters — and the first print on any chart is always a buy.

Two new entry classes — TREND BUY for stage-2 breakouts the valuation-gated model used to miss, and CAP BUY for the reclaim after a capitulation flush.

Two new structural exits — an ATR-extension sell for parabolic blow-offs and a stopping-volume sell for climax distribution bars.

Campaign Mode is now on by default: staged entries, adds earned with ~1R of open gain, and partial trims instead of all-or-nothing exits. Exits are labelled by the entry that opened them.

New Risk-Off regime driven by real VIX and S&P breadth data, plus a Model Backtest row showing win rate, average PnL and trade count.

New "Confirm on close" option for anyone who wants strictly non-repainting signals.

Fixed: the fair-value engine subtracted interest and tax instead of adding them back, and one valuation leg was circular — valuations move materially on most symbols.

Fixed: the quality gate and the moderate-regime tiers were comparing against text that never appeared, so neither ever adjusted thresholds. Both are live now.

Fixed: a single missing macro data point could silently suppress every signal on a chart.

Fixed: the Elliott wave module was stuck in a permanent bearish state; indices and ETFs were taking a penalty meant for stocks; and the backtest booked trades at the wrong price.

Fixed: weekly and monthly charts now use the intended moving averages, correctly scaled macro windows, and draw all three level sets instead of just one.

The India-flavoured "FII Sensitive" regime is now "Dollar Sensitive" with US-appropriate guidance — update any alerts keyed on the old name.

---

# 29 July 2026 wave — IN Analytics Pro v2.3 · US ANALYTICS
_The cheat entry, and the end of frictionless backtest numbers._

## ⚠️ Behavior changes (read before trusting old signals)

| Change | Old behavior | New behavior | Why it matters |
|---|---|---|---|
| **Backtest is no longer frictionless** | Win rate and average PnL assumed zero cost | Every closed trade is charged a full statutory + brokerage + slippage round trip (India ≈ 0.22% + DP + slippage; US ≈ SEC 31 + FINRA TAF + slippage) | Win rate and average both drop. On some symbols an average that was positive turns into a **losing compounded chain** — that gap was always there, it just wasn't shown |
| **New "Backtest Risk" row** | Only `win% · avg · n` | Adds the compounded ×multiple, max drawdown, and best/worst single trade | The ×multiple is the honest answer to "what would I have?". `(1 + avg)^n` is arithmetic and always overstates it — the tooltip now prints both side by side so the gap is visible |
| **New CHEAT BUY entry class (ON)** | Three entry classes | Fourth class: a Stage-2 advance pulling back into its 40-week (200-day) EMA on dry volume | More entries, all of them continuation setups with a stop a fraction of an ATR away rather than a base-depth |
| **Campaign trims need confluence (default ON)** | Either the ATR-extension or the volume-stop factor trimmed a tranche | Both must be live on the **same bar** | Far fewer trims. **A lone factor on a pyramided campaign (≥2 tranches) now does nothing at all** — no trim and no full SELL — so the core rides to the structural SELL. Set the toggle OFF to restore the old behavior |
| **S1 / S2 relabelled by sequence** | S1 = "ATR-extension trim", S2 = "volume-stop trim" — cause labels, while P1/P2 were sequence labels | S1 = the campaign's first trim, S2 = every later one | A campaign whose trims were all volume-driven printed S2, S2, S2 and **never an S1**, and a campaign's very first trim could read "S2". The cause is not lost — the hover tooltip names it |
| **"Current PnL%" during a campaign (IN only)** | Open leg only, gross — a campaign that trimmed at +30% could read +5% while actually being +20%, then jump at the final SELL | Banked trims **plus** the open leg, net of costs — exactly what the campaign-ending SELL will book | The live cell and the realized booking can no longer disagree. US already worked this way |
| **"Last 3 PnL%" and "Current PnL%" are net** | Gross | Net of the cost model | Consistently lower, and consistent with the backtest row |

## 🐛 Fixes

- **S1/S2 were cause labels masquerading as sequence labels** *(IN only — US was already correct)*. `S1` meant "ATR-extension trim" and `S2` meant "volume-stop trim", while `P1`/`P2` meant first add / second add. On any name whose trims were volume-driven you would never see an S1 in your life, and the first trim of a campaign could appear as "S2". Now sequential, with the trigger named in the tooltip.
- **Trim tooltip named the wrong witness.** The cause lines keyed off the factors' *rising edges*. In confluence mode a trim fires on the both-active edge, by which point one factor's own edge is already history — so the tooltip could report a volume-stop when the extension was the live condition. Both lines now read the level conditions and print together on a confluence trim.

## ✨ New features

**CHEAT BUY — the 40-week EMA bounce.** Weinstein's continuation entry, and the tightest-stop setup in the model. Fires when a Stage-2 advance pulls all the way back *into* its 40-week (200-day) EMA. All six conditions required:

- the bar's low reaches within 0.5 ATR of the MA, and the close doesn't end more than that below it
- the close sits in the upper half of the bar's range — buyers took the MA back the same bar
- volume ≤ 1.5× the 20-bar average: a dry rest, not distribution
- the 40-week MA itself is rising over 10 bars
- a live Stage 2 was read within the last 60 bars — beyond that the advance is stale and the touch is just a downtrend passing through
- relative strength positive (Mansfield on IN, ratio-vs-SPX on US)

It only *arms* after price has traded ≥2 ATRs above the MA, so the setup must come **down** to the MA out of an advance rather than grinding sideways on it — and the arm is consumed on entry, giving exactly one CHEAT BUY per pullback rather than a string of them. Timeframe-aware: 200 bars on daily, 40 on weekly, 10 on monthly.

**CHEAT CLOSE — the invalidation.** Armed only for positions a cheat entry opened (a TREND BUY does not get a 40-week-MA stop). A close below the MA minus 0.75 ATR exits **in full**, bypassing every churn gate, never as a partial trim — a broken 40-week MA invalidates the whole thesis. On IN it also overrides the webhook stop, so a cheat trade routes with the MA stop instead of the generic ATR stop. A cheat position closed by score/extension/volume instead is labelled **CHEAT SELL**, so a cheat round trip always reads as a pair.

**Real-world cost model** (new "Backtest Costs" input group).

*India (IN Analytics), rates current 29 Jul 2026:*

| Leg | STT | Stamp | Exchange | SEBI | GST | DP |
|---|---|---|---|---|---|---|
| Buy | 0.100% | 0.015% | 0.00297% | 0.0001% | 18% on brok+exch+SEBI | — |
| Sell | 0.100% | — | 0.00297% | 0.0001% | 18% on brok+exch+SEBI | ₹12.50 + GST |

Presets: Dhan delivery (₹0 brokerage, default) · Discount broker (₹20/order) · Custom · Off. Round trip ≈ **0.222% + DP + slippage**; slippage defaults to 5 bps per side.

*US (US ANALYTICS):*

| Charge | Rate | Side |
|---|---|---|
| SEC Section 31 | 0.00206% ($20.60 per million, effective 4 Apr 2026) | Sell only |
| FINRA TAF | $0.000166/share, capped $8.30/trade | Sell only |
| Commission | $0 retail, or IBKR Pro $0.005/share ($1 min, 1% max) | Both |
| Slippage | 3 bps default | Both |

No stamp duty, no transaction tax, no depository charge — the US stack is dominated by slippage rather than statute. Note that TAF is *per share*, so as a percentage it is `0.000166 / price`: a $10 ticker pays roughly 40× what a $400 ticker pays in percentage terms. Capital-gains tax is deliberately **not** modelled — it is assessed on your annual net position, not per trade, so folding it in would double-count against losers.

Sell-side levies are charged on *exit* turnover, so a bigger winner correctly pays more. Campaign trims are netted at their own weight, so a pyramided campaign pays exactly one round trip on committed capital — no more, no less.

**"Backtest Risk" row.** `×3.4 · maxDD 18.2% · best +41% / worst −12%`. The ×multiple chains every closed trade in sequence, net of costs. Max drawdown is the deepest peak-to-trough fall of that same curve — the pain you would have had to sit through to collect the multiple. Best/worst expose a multiple carried by a single outlier.

**"40W EMA / Cheat" row.** Distance to the 40-week EMA in ATRs plus live machine state: ARMED / not armed / stage-2 stale / cheat position with its live stop.

**Trim-mode toggle.** "Trim needs BOTH exit factors (confluence)", default ON. OFF restores either-factor trimming and labels the marker by cause: `S[ATR]`, `S[VS]`, `S[A+V]`. Alerts and the webhook stay **sequence-based in both modes** (`s1`/`s2`), so flipping a display preference never changes what a downstream router receives.

## ⚙️ Changed defaults

- **Backtest Costs = ON** (Dhan delivery on IN, zero-commission retail on US). Set the model to "Off (frictionless)" to reproduce the old numbers exactly.
- **Slippage** 5 bps/side (IN), 3 bps/side (US). On IN this is auto-netted against the legacy "Backtest slippage" input, so slippage can never be counted twice.
- **Assumed capital per trade** ₹1,00,000 (IN) / $10,000 (US) — the only place trade size enters a percentage-based backtest. Set it to what you actually deploy: on a ₹25k trade a ₹15 DP charge is 0.06%, on ₹5L it is 0.003%.
- **CHEAT BUY = ON**, **Trim confluence = ON**.

## 🧪 Test plan (before publishing)

1. **Costs actually bite.** Note the Model Backtest cell, then set Cost model to "Off (frictionless)". *Pass:* the average rises and the cell's suffix flips from "(net)" to "(gross)". Set it back — the numbers return exactly.
2. **The compounding gap is visible.** Hover Model Backtest. *Pass:* the tooltip states the naive `(1 + avg)^n` figure **and** the real chained ×multiple, and they differ. On a symbol with a positive average but a ×multiple below 1.0, that is the feature working, not a bug.
3. **Drawdown is real.** *Pass:* Backtest Risk maxDD is > 0 on any symbol with more than a couple of closed trades, and `best` ≥ `worst`.
4. **Cheat arms and fires.** On a Stage-2 name, watch the "40W EMA / Cheat" cell. *Pass:* it reads ARMED only after price has been ≥2 ATRs above the 40W EMA, and a violet CHEAT triangle appears only on a bar whose low reaches the MA band with a close in the upper half of the range on ≤1.5× volume.
5. **One cheat per pullback.** *Pass:* price hugging the MA for several bars produces exactly one CHEAT marker, not one per bar.
6. **Cheat stop works.** With a cheat position open, the cell shows "cheat position — exit under {level}". *Pass:* a close below that level prints a violet CHEAT CLOSE, and it fires even inside the min-hold window (structural exits bypass the churn gates).
7. **Every exit has a marker.** Scan full history. *Pass:* every entry marker of any class is followed by exactly one exit label — SELL, TREND SELL, CAP SELL, CHEAT SELL or CHEAT CLOSE — before the next entry. Zero unlabelled exits.
8. **S1 actually appears.** With Campaign Mode ON and the trim toggle OFF, find a campaign with ≥2 tranches and two trims. *Pass:* the first trim is `S[ATR]` or `S[VS]` per its cause; toggle confluence ON and *Pass:* the first trim of a campaign reads S1, never S2.
9. **Confluence really restricts.** Toggle ON. *Pass:* trim markers become markedly rarer, and a bar with only an extension (no volume stop) produces no trim **and** no SELL while ≥2 tranches are open. This is expected — confirm you are comfortable with it before leaving it on.
10. **Alerts unchanged by the toggle.** Fire an S1 alert in each mode. *Pass:* the alert fires on the campaign's first trim in both, regardless of which label the chart drew.
11. **Campaign PnL agrees with itself (IN).** With a campaign open that has already trimmed. *Pass:* "Current PnL%" includes the banked trim, and does not jump when the final SELL prints.
12. **Weekly/monthly sanity.** Switch to a weekly chart. *Pass:* the 40W EMA cell still reads sensible values (the length rescales to 40 on weekly, 10 on monthly) and cheat markers remain plausible.


### Cheat entry v2 — same-day rework (29 Jul, after a live MANINDS review)

The first cut of the cheat entry shipped and was reviewed on a live chart the same day. Two things
were wrong, and both are corrected in the build being published:

**Entry was too loose.** The arm never expired, so ANY later brush of the 40-week MA could fire —
including a sideways chart drifting along the line. It is now a leg state machine: price must trade
clear above the MA (a real advance), the FIRST touch of that leg opens a short bounce window, and
when the window closes the leg is spent. A second visit is not a cheat entry — it is the MA failing
as support — and the setup must re-arm from a fresh advance. A new stage-banked counter additionally
requires real Stage-2 time before any touch qualifies.

**Exit defeated the thesis.** A cheat entry is a CONTINUATION trade, but it was being closed by the
ordinary score SELL — which only fires once the composite has decayed, long after price has rolled
over. Live review showed cheat trades round-tripping most of their gain. Three fixes:
- cheat positions are now HELD THROUGH score SELLs entirely (default ON)
- a chandelier trail releases the trade a fixed ATR distance below the highest high since entry —
  catching the top of a thrust by construction rather than by the score noticing late
- a momentum-fade exit closes on a return under the EMA21 while in profit, typically several bars
  ahead of the chandelier on a slow fade
- the stop ratchets to breakeven, then trails the EMA50; it never moves down

Exits are now labelled by OUTCOME: **CHEAT TRAIL** (green — released in profit near the high) versus
**CHEAT CLOSE** (violet — stopped out, the 40-week thesis broke).

### Verdict icons on the dashboard rows

Every gate row now carries the verdict inline instead of leaving it to be computed: ✅ supports
acting · ⚠️ works with a caveat · ❌ do not act · ⚪ neutral or too thin · ⏳ warming up or held ·
🔒 held by weekly structure · 🎯 live cheat position. Edge is judged on the COMPOUNDED multiple,
never the average; under 20 trades the cell is ⚪ and marked "thin"; a `🎲one-trade` tag appears when
a single trade is worth more than half the entire summed edge.

## 📋 Publishing blurb (paste into TradingView release notes)

New CHEAT BUY entry class: a Stage-2 advance pulling back into its 40-week (200-day) EMA on drying volume, with the close reclaiming the average on the same bar. It only arms after price has traded well above the MA, so the setup has to come down to it out of an advance — one entry per pullback, not a string of them.

CHEAT CLOSE is its invalidation: a close below the 40-week EMA exits in full and bypasses every hold gate. That is the point of the setup — the stop sits at the moving average, a fraction of an ATR away instead of a base-depth below.

The self-backtest is no longer frictionless. Every closed trade is now charged a real round trip — STT, stamp duty, exchange and SEBI fees, GST, DP charge and slippage on the India build; SEC Section 31, FINRA TAF and slippage on the US build — with presets for zero-brokerage and discount tiers. Sell-side levies are charged on exit turnover, so bigger winners correctly pay more.

New Backtest Risk row: the compounded multiple, the maximum drawdown of that equity curve, and the best and worst single trades. The multiple chains the actual sequence of trades, which is the honest answer to "what would I have?" — the average per trade never was, and hovering the row now shows both numbers together so the difference is visible.

Campaign trims can now require confluence: by default a tranche is trimmed only when the ATR-extension and stopping-volume factors are both live on the same bar. Turn it off to restore either-factor trimming, in which case the marker names the cause: S[ATR], S[VS] or S[A+V].

S1 and S2 now mean first trim and later trims, matching P1 and P2. They previously named which factor fired, which meant that on names whose trims were volume-driven an S1 never appeared at all.

Fixed: while a pyramided campaign was open, the current-PnL cell showed only the open leg and ignored partials already banked, so it understated the position and jumped at the final exit.

A cheat trade is now held through ordinary score exits and released by its own trailing stop instead — a chandelier a fixed ATR distance below the highest high since entry, a momentum-fade exit on a return under the EMA21 while in profit, and a ratchet to breakeven that never moves down. Exits are labelled CHEAT TRAIL when released in profit and CHEAT CLOSE when stopped out.

Cheat entries only fire on the FIRST touch of the 40-week average after a genuine Stage-2 advance. A later revisit is the average failing as support, not a setup, and must re-arm from a fresh advance.

Dashboard rows now carry a verdict icon so each read is legible without arithmetic.

Recommended: set "Assumed capital per trade" in the Backtest Costs group to the size you actually deploy — flat charges like the DP fee are a very different percentage on a small position than a large one.

---


---

# 30–31 July 2026 wave — IN Analytics Pro 3 · US ANALYTICS · Valuations ++ v5.3

## ⚠️ Behavior changes (read before trusting old readings)

| Change | Effect |
|---|---|
| **Circular valuation fallbacks removed** (IN ×3, US ×2) | Symbols with no usable multiple history previously showed a fabricated fair value ≈ price → ratio 1.00 "fairly valued", **and counted as a working method**. You will now see some symbols move from `4m` to `3m`/`2m` confidence, and some valuations go from a confident number to **N/A**. That is the fix working — a silent wrong answer became a visible gap. |
| **US coverage loss** | US has no P/B leg and its P/S leg already contributed 0, so a US symbol with no usable P/E history now rests on EV/EBITDA alone or reports N/A. Real loss of coverage, deliberately accepted. |
| **Classification rebuilt (IN + V++)** | Weights per company change. Most visible on **banks/NBFCs** (EV/EBITDA now 0, P/B 0.55) and **profitable small-caps** (were valued as startups at P/E weight 0.1, now 0.40–0.50). |
| **Multiple sampling is now timeframe-aware (IN)** | On weekly charts the "3-year" P/E window previously spanned ~14 years. Fair values on weekly charts will shift, in some cases materially. |
| **Volume-stop is location-gated** | Fewer exits near lows; positions hold longer through post-entry volatility. Winners may exit later than before. |
| **Normalized Scoring ON by default (IN)** | Score and thresholds move to the σ scale. Entries and exits differ from the raw path. Will not engage below 500 bars — ~2y daily but **~10y weekly**. |
| **Aggressive mode ON by default (IN + US)** | CAP BUY may now fire in confirmed downtrends. That is where genuine capitulation reclaims happen, and also where knives are. |

## 🐛 Fixes

- **Whipsaw on SONACOMS.** The volume-stop's location filter had a branch requiring nothing about *where* price was — any red bar taking out the prior high qualified. Five bars after a capitulation-low entry on 3.16× volume it closed a good campaign at +0.78%, forcing a re-entry 23 points higher. Now requires the bar to have traded above the reference EMA.
- **Move hurdle was symmetric.** A trade 2 ATR *into profit* waived its own 10-bar minimum hold and became eligible for an early score exit. Now adverse-only.
- **"Early Stage" misclassification.** Every profitable small-cap under ₹5,000 Cr was classified a pre-revenue startup, because size was tested before stability. Found by questioning the label on a sixty-year-old pharma company.
- **Entry @ Price** now shows the individual tranche fills beside the blend — `417.15 (3t @ 377.70 / 410.20 / 503.10)` — which explains why a winning campaign can show a modest percentage.
- **CE10235** compile error (if/else return-type mismatch) and **CE10117** compiled-token ceiling, both resolved.

## ✨ New features

**Edge by Entry Class** (IN + US) — splits the same closed campaigns by the class that opened each one:
```
BUY 52%·+28.9%·n11   TRD 60%·+1.3%·n5   CHT 0%·-8.4%·n1
```
The pooled backtest cannot tell you which entry path carries the model and which drags it. Read this before tuning any entry filter.

**Two new company classes** (IN + V++):
- **Lender** — for a bank or NBFC debt is raw material, not leverage, so EV/EBITDA is meaningless. Weight now **0.00**, with P/B at 0.55. Previously every bank got a 0.3–0.6 EV weight.
- **Cyclical** — P/E *inverts* across a cycle: lowest at the earnings peak when the stock is most dangerous. De-emphasised, with EV/EBITDA and P/B anchoring. Cyclicals also take the full P/E history window, since a 3–5 year window can sit entirely inside one leg of a cycle.

**External fair value bridge** (IN ← V++) — point IN at Valuations++'s `🔗 Fair Value (bridge export)` plot and IN inherits its percentile bands, winsorized sampling, CV-derived weights and stationarity gate, with no duplicated maths. Default OFF, guarded, silent fallback — a free-tier user running IN alone under the 2-indicator cap is never affected.

**Auto (Company Type) preset** (V++) — classifies instead of making you pick Value/Growth/GARP/Income. Wired as a prior, so CV blending still refines it: `Auto: Stable Value [CV-blended]`.

**`Volume-stop: min bars held`** (IN + US) — `-1` = auto by timeframe (monthly 0 / weekly 1 / daily 2 / intraday 6).

## ⚙️ Changed defaults

| Setting | Old | New | Script |
|---|---|---|---|
| Use Normalized Scoring | OFF | **ON** | IN |
| Normalization lookback | 200 | **500** | IN |
| Aggressive mode | OFF | **ON** | IN + US |
| Volume-stop: min bars held | — | **−1 (auto)** | IN + US |

**TradingView keys saved values by title, so charts you have already saved keep their old values.** Set these by hand once, then Defaults → Save as Default.

## 🧪 Test plan (before publishing)

1. **SONACOMS daily** — the spurious second SELL should be gone. Then set `volStopMinBars` to 0: if it stays gone, the location guard alone is sufficient and you keep the bull-trap exit intact.
2. **PANACEABIO** — IN and V++ must now agree on company type (`Loss-making`). If they disagree, one paste didn't take.
3. **Any bank/NBFC** — confirm the class reads `Lender` and EV/EBITDA weight is 0. Industry-string matching will miss oddly-named NBFCs.
4. **A profitable ₹2,000–5,000 Cr small-cap** — must no longer read as a startup; expect `Quality Compounder` or `Steady`.
5. **Weekly chart of a 10+ year name** — fair value will differ from before. That is the sampling fix, not a regression.
6. **A symbol with no earnings history** — valuation should read **N/A**, not a confident number.
7. **Bridge** — enable it, confirm IN's Composite Value matches V++'s median exactly. If it doesn't move, the guard is rejecting the source; re-point at `🔗 Fair Value (bridge export)`, not `🎯`.
8. **Free-tier simulation** — remove V++ from the chart with the bridge still enabled. IN must fall back silently with no error.
9. **Edge by Entry Class** across 3–5 names before acting on any single reading — per-class n is small.
10. **Model Backtest / Backtest Risk before vs after** on a few names. Gating the volume-stop means winners exit later; if maxDD worsens materially, trim `minHoldBars` rather than reverting.

## 📋 Publishing blurb (paste into TradingView release notes)

```
Fixes and upgrades to the valuation and exit engines.

• Valuation no longer falls back to a price-derived estimate when a stock's own
  multiple history is unusable. Those cases now report N/A with a reduced
  confidence count instead of a fabricated "fairly valued" reading.
• Historical multiples are now sampled at a consistent quarterly cadence on any
  timeframe. Previously a weekly chart sampled every ~14 months, so the
  "3-year" window spanned far more than three years.
• Company classification rebuilt into seven classes, adding Lender (EV/EBITDA
  is meaningless for a bank — P/B anchored instead) and Cyclical (P/E inverts
  across a cycle, so it is de-emphasised). Profitable small-caps are no longer
  classified as pre-revenue startups.
• The stopping-volume exit now requires price to have traded above its
  reference average, so it fires on distribution rather than on ordinary
  volatility shortly after an entry.
• The early-exit valve on the minimum-hold gate is now adverse-only: a trade
  running into profit no longer unlocks its own early exit.
• New "Edge by Entry Class" row splits the self-backtest by the entry type that
  opened each campaign.
• Optional external fair-value source, for use alongside Valuations ++.

Defaults changed: normalized scoring on, lookback 500, aggressive mode on.
TradingView keeps saved settings per chart, so existing charts retain their
previous values — set them by hand if you want the new behaviour.
```

## 📌 Known limits carried forward

- **IN Analytics is at ~100,071 of the 100,256 compiled-token ceiling (~185 spare).** The next feature requires removing something. Candidates by approximate compiled cost: Eco/Fundamental table ~8,000 · Regime table ~3,600 · Risk table ~2,100 · signal-tooltip subsystem.
- **US has not received the classification rework.** It does not carry IN's size-outranks-stability bug (it keys on history depth, which was always right), but it lacks Lender and Cyclical — so US banks and commodity names are still mis-weighted. Porting needs a 3-column weight table since US has no P/B leg.
- **Lender detection is industry-string matching** and will miss oddly-named NBFCs.
- **IN and V++ can disagree on Cyclical vs Quality** — V++ measures a true stdev of realised growth, IN only a one-period estimate-vs-actual gap.
- **`volStopMinBars` has a real cost:** a fast bull trap (TREND BUY failing on climax volume within 2 bars) loses its volume-stop exit. 2 on daily / 0 on weekly recommended.
