OPEN-SOURCE SCRIPT
Zaktualizowano

HTF Regime Navigator [HRN]

417
HTF Regime Navigator [HRN]

█ OVERVIEW

The HTF Regime Navigator is a top-down market analysis dashboard built on one premise: markets spend most of their time in ranges, and a trend has to be earned. It is not a buy/sell arrow generator. It answers three questions, in order, and shows its reasoning for each:

1. What environment are we in? (the Regime engine)
2. Which way does the weight of evidence lean? (a fully transparent, user-weighted scoring model expressed as Bull / Base / Bear percentages)
3. Where is the high-quality price to act? (EMA–Fibonacci confluence — "a place to do business")

"HTF" means higher timeframe: the tool is designed for traders who set their bias on the weekly or daily chart and execute lower, though every module is timeframe-agnostic and works on any liquid symbol.

█ WHO IT'S FOR

• Swing and position traders who form their bias on the weekly or daily chart and execute lower — the defaults, the workflow, and the dashboard's top-down read order are all built around that sequence.

• Range and reversal traders: anyone who buys pullbacks into value (the Fibonacci golden zone, EMA retests, Wyckoff springs) rather than chasing breakouts. Most of the machinery exists to identify what kind of range you are in and where the high-quality prices sit inside it.

• Traders who think in probabilities and scenarios rather than binary calls. The forecast is expressed as three weighted cases — Bull, Base, Bear — and the Action row says STAND ASIDE far more often than it suggests positioning.

• Process-oriented traders who want to see the reasoning. Every classification and every probability decomposes into visible, re-weightable components, so the tool suits people who want to audit and tune a model, not follow arrows.

• Discretionary traders who do their own research: the Discretionary Overlay feeds macro, catalyst, flow, and consensus work into the same probability engine as the chart evidence.

Who it is not for: scalpers wanting high-frequency intraday signals, or anyone looking for a black-box buy/sell system. The fractal-based structure confirms with a deliberate lag, the engine is designed to keep you out of the market most of the time, and it will not do your thinking for you.

█ THE LOGIC BEHIND THE INDICATOR

Every module encodes one of five working assumptions about how markets behave:

1. Consolidation is the default state. Markets spend the large majority of their time ranging; genuine trends are the exception. The burden of proof is therefore inverted: instead of asking "is this a trend?", the engine assumes range until a breakout is confirmed by the moving-average stack in both side and slope. This single prior removes the most expensive class of error — treating every breakout as the start of a trend.

2. Regime is permission, forecast is bias, confluence is location and trigger. Three separate questions, answered in order. The regime decides which trades are even on the table. The forecast decides which direction deserves the benefit of the doubt, and how strongly. Confluence decides where acting on that bias offers favorable prices. The layers are kept independent on purpose, so a disagreement between them (for example, a bullish confluence lighting up against a bearish lean) is information rather than noise.

3. Evidence moves probabilities; it never creates certainty. The forecast starts from a base-case prior — "nothing resolves, the chop continues" — and each piece of evidence (structure, regime, entry value, divergence, Wyckoff behavior, your own research) shifts probability away from that prior in proportion to the weight you assign it. A hard floor keeps the base case alive no matter how one-sided the evidence looks, because chop is always possible. This is why the output is three scenario probabilities rather than a signal.

4. Location matters as much as direction. A correct bias executed at a bad price is still a bad trade. The Entry Value component scores extended price negatively even when the bias is bullish, and the confluence engine only lights up where independent forms of support overlap — moving averages sitting inside the Fibonacci value zone, ideally with price there too and slopes turning. That overlap is the "place to do business."

5. The best reversal entries occur where structure has just been recovered. A Wyckoff spring is a failed breakdown — a shakeout that closes back inside the range, showing supply exhausted below. A fresh EMA reclaim is the same event expressed in moving-average terms. The optional signal engine is built entirely around this: it requires freshly recovered structure (a recent slope flip, a fresh reclaim, or a qualified spring) and then triggers on the reclaim itself or the first tests of the fast EMA afterward — never on stale, mid-trend states.

Because each assumption is implemented as visible, weighted, adjustable components, the tool doubles as a measurable model: when it is wrong, the Breakdown table shows which component was wrong, and you can re-weight accordingly.

█ WHY THIS COMBINATION IS ORIGINAL AND USEFUL

HRN uses classic building blocks — multi-timeframe EMAs, Williams fractals, Wyckoff springs/upthrusts, RSI divergence, Fibonacci retracements, and a volume profile. What makes it original is that these are not stacked side by side; they are wired into a single decision engine with an explicit consolidation prior:

• One structure feeds everything. The Williams-fractal range defines the structure every other module measures against: springs and upthrusts are validated against the range's edges and height, the Fibonacci golden zone anchors to it by default, and the Entry Value score is price's position within it.

• Trends must be earned. The regime engine refuses to call a trend on a breakout alone — the breakout must be confirmed by a user-set number of EMAs agreeing in both side and slope. Until then, the market is classified as a range, and the engine's job becomes determining what kind of range it is (accumulation, distribution, or neutral) by counting independent evidence.

• Evidence becomes probabilities through an honest prior. Six components (MA Structure, Regime, Entry Value, HTF Divergence, Wyckoff, Discretionary Overlay) are each normalized to −100…+100, weighted by inputs you control, and mapped to Bull / Base / Bear percentages through a base-case prior with a hard floor. The model is structurally prevented from claiming near-certainty, because chop is always possible.

• The layers gate each other. The confluence highlight and the optional mechanical signal engine both consume the same canonical golden zone; the signal engine is vetoed by the regime (no long signals in a confirmed downtrend by default) and assisted by Wyckoff events (a recent qualified spring satisfies the reversal-freshness requirement for longs, an upthrust for shorts).

• Everything is auditable. The Forecast Breakdown table shows score × weight = contribution for every component, so you can see exactly why the model leans the way it does — and re-weight it when you disagree. The tool is meant to be tuned like a model, not trusted like a black box.

That integration — one structural range feeding one weighted evidence model feeding one location filter, under an explicit "consolidation is the default" prior — is not reproducible by simply adding the individual indicators to a chart.

█ HOW IT WORKS

1 — HTF EMA Stack. Six independent EMA slots, each with its own timeframe, length, color, and toggle (defaults: chart 50/100/200 plus a weekly 50 visible; a weekly 200 and daily 50 are configured but off). For each active EMA the tool tracks which side price is on and the EMA's own slope, measured against its value a configurable number of higher-timeframe bars back.

2 — HTF Range (Williams fractals). Pivot highs/lows with configurable wings on a selectable range timeframe (weekly by default) define the range high and low. A breakout requires the range-timeframe close to exceed the boundary by a buffer percentage. A context lookback checks where price came from: falling into the range is an accumulation clue; rising into it, a distribution clue.

3 — Wyckoff engine. A spring is only accepted when the undercut penetrates no more than a maximum percentage of the range height, the bar closes back inside the range, the range is not already broken down, optional volume qualification passes (a quiet low-volume test, or stopping volume above a multiple of average), and a cooldown since the last signal has elapsed. Upthrusts mirror this at the range high. Separately, the up- versus down-bar volume share over a lookback gives the range an accumulation or distribution character (effort vs. result).

4 — HTF Divergence. Regular RSI divergence detected at confirmed pivots on a selectable timeframe (weekly by default).

5 — Regime engine. If price has broken out AND at least N active EMAs confirm the direction (correct side + correct slope), the regime is TRENDING UP or TRENDING DOWN. Otherwise the engine counts the bullish vs. bearish evidence above (range context, volume share, spring/upthrust, divergence) and classifies ACCUMULATION, DISTRIBUTION, or NEUTRAL RANGE, with a confidence read based on how far apart the evidence counts are.

6 — Forecast. Six components, each scored −100…+100:
• MA Structure — price's position across the active EMA stack.
• Regime — the classification's directional lean.
• Entry Value — how favorable current price is for the bias. It deliberately scores extended/expensive price negatively, even in a bullish setup — it exists to fight chasing.
• HTF Divergence — recent bullish/bearish divergence.
• Wyckoff — recent spring/upthrust plus the volume-share character.
• Discretionary Overlay — four dropdowns you set from your own research (macro liquidity, upcoming catalysts, insider/institutional flow, analyst consensus), since Pine cannot read the news. Neutral by default.
The weighted sum produces a Net Score (−100…+100), which is mapped to Bull / Base / Bear percentages through a base-case prior (default 55%), a sensitivity, and a floor (default 15%). An Action row only suggests positioning when a case clears the actionable threshold (default 65%); otherwise it reads STAND ASIDE.

7 — Fibonacci engine. Full retracement and extension sets, each level individually toggleable, editable, and colorable. The anchor is selectable: the HTF Range (default), the last detected Swing High/Low, or a Lookback High/Low. Orientation follows the forecast bias automatically or can be forced Uptrend/Downtrend. The canonical 38.2–61.8 golden zone drives entry detection regardless of which display levels you show, and the zone can be filled in one or two bands.

8 — EMA-Fib Confluence. When the selected EMAs sit inside or near the golden zone (tolerance measured as a percentage of the fib range), optionally requiring price in the zone and an EMA slope filter, the chart paints a background band and the dashboard glows green or red. This is the location cue — the "pay attention" state.

9 — Signal engine (optional). A mechanical fresh-reversal detector: per-EMA tri-state classification (above / testing / below, with a % or ATR-fraction tolerance), reclaim tracking, slope-alignment freshness windows, a first-K-tests-after-reclaim route (the first pullback test can come weeks after a reclaim, so it is counted in episodes, not bars), optional EMA stack-order requirement, Wyckoff assist, higher-timeframe regime veto, optional volume gate, confirmation closes, cooldowns, and invalidation on a close beyond the lowest (or highest) signal EMA plus a buffer. A 0–100 confluence score is always computed and can optionally gate entries. State machine: SETUP → PENDING → CONFIRMED → HOLDING → INVALIDATED, with fully customizable chart markers.

10 — Volume Profile. Up to 100 rows over up to 1500 bars, POC / VAH / VAL lines and labels, optional up/down volume split per row.

11 — Dashboard + Forecast Breakdown tables. Every row can be toggled off to shrink either table. The whole-table tint source is selectable: EMA-Fib Confluence (default), Signal Engine, Both, or Off.

12 — Alerts. One dynamic alert() covers every toggled event with a rich message (regime change, spring/upthrust, HTF divergence, entry zone + bias alignment, probability threshold crosses, confluence start, signal confirmed, setup forming). Individual alertcondition() hooks are also provided. Create a single alert on the indicator with "Any alert() function call" to receive all enabled events.

13 — Data bus. A few hidden (display.none) plots expose the regime code and key event streams so that other indicators on the same chart can read them as an external source input.

█ HOW TO USE IT

The 30-second read, top to bottom:
1. Is the dashboard glowing green/red, or is there a background band on the chart? That means a confluence area is live right now.
2. Regime row — trend or range, which kind, and at what confidence. A Low confidence means the evidence is nearly tied; treat it as a hint, not a conclusion.
3. Range position — is price cheap (low in the range) or expensive (high in the range)?
4. EMA-Fib Conf row — if confluence isn't firing, the detail cell tells you exactly which condition is missing (E1/E2/E3 = EMAs in zone, P = price in zone, S = slope filter).
5. Bull / Base / Bear percentages and the Action row — the bottom line.

A suggested top-down workflow: set the bias on the weekly (regime + the weekly EMA slope), drop to the daily to find the setup, and only act where the confluence band lights inside the golden zone. Honor the Entry Value component — it penalizes chasing on purpose. Fill in the Discretionary Overlay from your own research; it is neutral until you do, and it flows into the Net Score at the weight you assign it.

Note on the Fibonacci Auto direction: because the orientation follows the forecast bias, it can flip while regime confidence is low. If you have already made the directional call, force the Direction to Uptrend or Downtrend to lock the levels in place.

█ REPAINTING AND CONFIRMATION

• Every request.security() call uses lookahead_off.
• Fractals and divergence pivots confirm a fixed number of bars after the extreme (the Williams definition). They are late by design and are never repainted retroactively.
• Higher-timeframe values update while the live HTF bar forms and finalize at its close — treat reads as firm at the close of the relevant bar.
• Dynamic alerts fire on confirmed bars only.

█ SETTINGS NOTES

Every input carries a tooltip explaining what it does and what its default means. The highest-leverage settings are: MAs Required to Confirm Trend (the consolidation-first switch), the six Forecast Weights, the Probability Mapping group (prior, sensitivity, floor, actionable threshold), the Fibonacci Anchor Source and Direction, the EMA-Fib Confluence conditions, and — if you enable the signal row — the Entry Trigger mode, tolerance mode (% of price vs. ATR fraction), confirmation closes, and cooldown.

█ LIMITATIONS

• This is an indicator (decision support), not a strategy: it produces no performance statistics, and its Bull / Base / Bear percentages are the output of a transparent, user-weighted scoring model — heuristic evidence weighting you control, not a statistical prediction of returns.
• The Discretionary Overlay only contributes what you put into it.
• Fractal-based structure confirms with a deliberate lag; the tool trades immediacy for reliability.
• Defaults assume daily/weekly charts on liquid symbols; intraday works, but the higher-timeframe modules are less in their element there.
• Drawing objects (lines, labels, boxes) are pooled with configurable caps; the oldest objects are removed first.

█ DISCLAIMER

This script and its description are for educational and informational purposes only and do not constitute financial advice. No indicator predicts market outcomes. The tool is built to make its reasoning fully inspectable so that you can evaluate, adjust, and own your decisions. Always do your own research and manage your own risk.
Informacje o Wersji
v1.7 — SIGNAL ENGINE GATE-COMPOSITION FIX

The headline: the entry engine now actually fires on the setup it was named
for. In v1.3–v1.6.1, the "Reclaim + Test (fresh)" signal was a chain of AND
gates whose timing windows could not overlap in a real reversal — a textbook
sequence of reclaim → fresh 50/100/200 stack → pullback test of EMA1 was
silently vetoed by one gate or another at every stage, and the row that
would have shown you which gate was blocking was hidden by default. v1.7
recomposes the gates so the designed trade has a live path, without loosening
the engine mid-trend.

WHAT YOU'LL NOTICE
• LONG/SHORT signals now print on fresh-reversal reclaim and test setups
that previously stayed dark.
• The Signal dashboard row is ON by default and reads like a gate report:
Z✓/Z↺/Z✗ (fib zone: in / bypassed by a fresh license / vetoed), S✓/✗
(slope gate), K✓/✗ (stack order), plus R‹n› reclaim age, T‹n›/‹K› tests
used, F‹n› bars since the stack formed, and the confluence score.
• One new input: "Stack Memory (bars)" (Signal Engine, default 15).

FRESH LICENSES (the core change)
Three routes now mark a setup as NEW: a fresh reclaim (memory window or
un-consumed first-K tests), a freshly FORMED stack (within Stack Memory
bars — the direct encoding of "test of the EMAs while freshly stacked"),
and a recent Wyckoff spring/upthrust. Any license satisfies the reversal-
freshness requirement, bypasses the slope-alignment veto, and (in Reclaim +
Test mode) bypasses the fib-zone veto. With no license active, every gate
applies exactly as before — mid-trend states stay filtered.

FIXES
• Stack order: only CHART-timeframe EMAs participate in the ordering chain.
The default weekly-50 in slot 6 is a ~250-day-equivalent EMA — slower
than the chart 200 — so requiring 200 > weekly-50 was false for the
entire fresh-reversal window and hard-blocked every candidate. HTF EMAs
keep their reclaim / positioning / invalidation roles.
• Test budget: "Qualifying Tests per Reclaim" is now consumed ON USE only —
when the full candidate gate was open and the engine out of cooldown —
and the reclaim bar's own cross of EMA1 no longer counts. Previously any
touch burned bud

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.