OPEN-SOURCE SCRIPT

Cross-Asset Session Impulse Engine [PhenLabs]

2 887
📊 Cross-Asset Session Impulse Engine [PhenLabs]

Version: PineScript™ v6

[u]⚠️HEADS UP⚠️[/u]
  • Click the three dots on the right of the indicator after adding it to your chart and click pin to scale to make sure it is displaying properly


📌 Description
Cross-Asset Session Impulse Engine waits for the session opening range to lock, then asks a simple question before you take the break: did correlated markets print the same impulse, or is this chart running alone? A k-of-n basket (crypto, dollar, indices — you pick) must confirm in the same direction, with invert flags for assets like DXY that move against risk.

The engine is built for every TradingView plan. There is no footprint feed, no lower-timeframe history wall, and no silent crash when a basket symbol or volume field is missing. If the basket cannot load, the dashboard switches to chart-only and you still see the opening range. Confirmed signals, named alerts, and Pine Screener columns are included.

🚀 Points of Innovation
  • Opening-range break is gated by live cross-asset breadth instead of a single-chart close
  • Per-symbol invert flags so DXY-up can confirm a risk-off short without extra scripts
  • All-plan design: same-timeframe request.security only — no Premium-only data path
  • Dead basket symbols return na and drop out of the vote instead of aborting the script
  • Missing volume skips the optional gate and labels Vol N/A instead of refusing to load
  • Named bullish/bearish confirmed alerts plus Screener plots for breadth, signal, and armed state


🔧 Core Components
  • Session clock: New York, London, Tokyo, or a custom session/timezone pair
  • Opening range: first N session bars freeze ORH/ORL; later confirmed closes beyond those rails are impulses
  • Basket voter: up to four input.symbol contexts, each with its own opening range on the same clock
  • Confirmation gate: min k live same-direction votes, or chart-only when every basket feed fails
  • Projection: ATR targets from the broken rail and invalidation at the opposite side of the range
  • Dashboard: OR state, chart break, breadth, per-symbol arrows, data mode, signal


🔥 Key Features
  • Preset sessions so you are not locked to US cash hours
  • Enable/disable and invert each basket symbol; unused inputs stay hidden
  • Optional relative-volume filter that degrades to off when the symbol has no volume
  • Unconfirmed chart-break markers are hidden by default to keep price readable
  • One confirmed signal per session, both directions, with alertconditions
  • Screener-ready numeric plots (breadth net, signal +1/−1, armed)


🎨 Visualization
  • Dashed ORH/ORL rails and a translucent opening-range box on the session
  • Dotted ATR targets and a dashed invalidation line after a confirmed signal
  • Triangle markers for confirmed impulses; optional faint circles for unconfirmed chart breaks
  • Top-right dashboard: session, OR lock, chart state, breadth, basket tape, data mode, signal


📖 Usage Guidelines
  • Session Preset — Default: New York — NY 09:30–16:00, London 08:00–16:30, Tokyo 09:00–15:00. Custom unlocks session and timezone.
  • Opening Range Bars — Default: 6 — Range: 1-48 — On 5m this is ~30 minutes (classic ORB). Raise it on 1m, lower it on 15m.
  • Min Basket Confirms — Default: 2 — Range: 0-4 — 0 fires on the chart break alone. Keep this ≤ the number of enabled live symbols.
  • Enable Symbol 1–4 — Defaults: BTCUSDT on, ETHUSDT on, DXY on (invert on), ES1! off — Use distinct tickers. Invert for inverse assets.
  • Require Relative Volume — Default: false — When on, confirmed bars need volume ≥ Min Rel Volume × SMA. No volume → gate skipped, dashboard shows N/A.
  • Show Unconfirmed Chart Breaks — Default: false — Turn on only when you want to see the raw OR break before breadth arrives.
  • Table Size — Default: Small — Tiny / Small / Normal. Visible only while the dashboard is on.


✅ Best Use Cases
  • Intraday ORB on indices, FX, and crypto during NY, London, or Tokyo
  • Filtering fake session breaks that do not show up in BTC, ETH, DXY, or ES
  • Risk-off reads: DXY invert on so a dollar spike confirms shorts on the chart
  • Watchlist screening via the XSIE Signal and XSIE Breadth Net columns


⚠️ Limitations
  • Designed for intraday session charts. Daily bars often sit outside a cash-session window and will show OR as OUT.
  • Basket symbols that match the chart ticker are skipped so the chart cannot vote twice.
  • Confirmation can arrive after the chart break (late breadth). That is intended; the armed state stays until session end or confirmation.
  • One signal per session. Opposite-range invalidation flags the trade; it does not flip and re-fire.
  • Pine Screener itself is a paid TradingView product. The script only exposes plots — it does not unlock Screener on a free account.


💡 What Makes This Unique
  • Cross-asset k-of-n is the confirmation, not a decorative correlation table
  • All-plan data path with an explicit chart-only fallback when the basket is dead
  • Invert-aware votes treat DXY as a risk switch instead of a same-direction clone


⚙️ Under the Hood
  • Same-timeframe request.security basket: four unrolled tuple calls fetch OHLC on timeframe.period with lookahead_off and ignore_invalid_symbol=true. Invalid tickers return na and drop out of breadth instead of throwing. This is not lower-timeframe volume and not footprint — every plan sees the same engine.
  • Opening-range state machine: each context (chart + basket) freezes ORH/ORL after N session bars. A break is the first confirmed close beyond the frozen rail. The lock bar cannot break because its high/low still define the range.
  • Invert mapping: when Invert is on, an upside OR break on that symbol votes for a downside chart impulse (and vice versa).
  • Data mode: no plan-gated feed is used. The Data row reports All-plan, live/enabled count, Vol x.xx or N/A, vol gate skipped, or basket failed · chart-only.
  • Screener and alerts: plot XSIE Breadth Net, XSIE Signal (+1/−1 on the confirmed bar), and XSIE Armed. alertcondition titles are “XSIE Bullish Impulse Confirmed” and “XSIE Bearish Impulse Confirmed” — not a generic “extreme event”.


🔬 How It Works
  1. The session clock marks bars inside the chosen window. A new session resets range, votes, drawings, and the fired flag.
  2. The first N bars build ORH/ORL. After lock, a confirmed close beyond a rail arms bull or bear on the chart.
  3. Each live basket symbol builds its own range on the same clock and casts an up or down vote (optionally inverted).
  4. When armed direction reaches min confirms — or the basket is entirely dead and chart-only mode is on — the engine fires once, projects ATR targets, and sets invalidation at the opposite rail.
  5. A confirmed close through invalidation flags INVALIDATED. The next session starts clean.


💡 Note:
Best on 1–15m charts with the session that actually trades your market. Seed the basket with assets you can actually resolve on your TradingView plan and region; failed symbols simply show ✗ and the rest keep voting. This is an analytical aid, not financial advice.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.