OPEN-SOURCE SCRIPT
AetherEdge - Quantum-Inspired Entanglement Detector

🖊️ Overview
A detector built on a "quantum entanglement" analogy. In entanglement, the states of several particles are so correlated that measuring one instantly informs the others. This engine transposes that onto markets: it measures the synchrony (entanglement strength) among several market variables — price, volume, and one or two correlated assets / global indices — and watches for decoherence, the moment that synchrony breaks down (a decoupling). A NeuraLib map weighs the pairwise couplings into a single Entanglement score, while a self-learning baseline distinguishes "normal" coupling from genuine breaks. Decoupling events — when the system falls out of its entangled state — are flagged as opportunity (divergence, regime shift). Visualization: a circular radar of Entanglement strength radiating from a center node to each variable, with alerts when synchrony collapses.
🔶 Key Features
Quantum-entanglement analogy — quantifies multi-variable synchrony as "entanglement strength"
Pairwise coupling detection — measures four links: price×volume, price×alt, price×index, alt×index
NeuraLib entanglement map — nonlinearly weights the couplings into a unified Entanglement score
Self-learning baseline — learns the "normal" synchrony level to judge genuine collapses by deviation
Decoherence detection — flags decoupling (opportunity) when entanglement drops sharply below baseline
Coherence/decoherence state — distinguishes synchronized (coherent) from collapsed (decoherent)
Circular entanglement radar — radial spokes from a center node to each coupling (length/color by strength) plus concentric rings
Intelligence panel — entanglement, baseline, decoupling magnitude, and each coupling strength at a glance
🧠 Technical Architecture
The engine pulls in a correlated asset and a global index via request.security and forms the "states" of four variables (price return, volume anomaly, alt return, index return).
As pairwise couplings, it computes the absolute rolling correlation |corr|∈[0,1] over four pairs (PX·VOL, PX·ALT, PX·IDX, ALT·IDX) — the strength of each "entanglement link." When all links are strong, the system is synchronized (high entanglement).
The NeuraLib entanglement map (couplings(4) → hidden(tanh) → entanglement strength(1, squashed to [0,1])) nonlinearly weights the couplings into a unified score. The target is the system-wide mean coupling (a self-supervised synchrony measure), and the network learns a smoothed, weighted estimate generalizing the raw mean.
For decoherence, it measures the drop from entanglement's self-learning baseline (a slow EMA tracking the "normal" level): baseline − current. When this clears the threshold, it flags decoupling. The key is catching deviation from the synchrony the system usually holds — not just low correlation.
The circular radar computes coordinates via math.cos/math.sin, drawing spokes from the center node to each coupling link with length proportional to coupling strength. Spoke color shifts with strength (red = collapse → cyan = sync), and concentric rings (25/50/75/100%) mark the scale.
⚙️ Recommended Settings & Tuning Guide
BTC (main) + ETH + TOTAL (1H–4H): Entanglement Window 40, Coherence 0.65, Decoherence 0.35 — a crypto setup
ETH (main) + BTC + TOTAL (1H–4H): BTC as the alt, the broad crypto market as the index
Stock (main) + peer + SPX/index: for single-stock coupling and decoupling detection
SOL (15m–1H): High volatility favors Entanglement Smoothing 5–6 to smooth, Decoherence Threshold 0.4 to be strict
Entanglement Window: longer is a steadier synchrony estimate; shorter is nimbler — ~40 is practical
Coherence Level: above this is "strong sync" — set to the group's typical correlation
Decoherence Threshold: a drop below baseline beyond this is decoupling; smaller is more sensitive (earlier warning)
Choice of alt/index: pick economically coupled assets/indices for detection accuracy
💡 How to Use in Practice
Reacting to decoupling alerts: a ⚡DECOUPLING marker is the moment usually-synced variables break apart — an opportunity for divergence trades or regime shifts; the broken variable may be "leading"
Reading the circular radar: a long, bright (cyan) spoke = strong coupling (synced); short, red = weak (collapsed). All spokes long = system-wide high entanglement; some short = partial decoupling
Using the coherence state: in COHERENT conditions the market moves as one (risk-on/off) and trends propagate; in DECOHERENT conditions idiosyncratic factors dominate, favoring selection and pair trades
Comparing to baseline: when panel entanglement is far below baseline, that's an abnormal break — judge deviation against the usual synchrony
Which coupling broke: the per-coupling rows (PX·VOL, etc.) identify which pair's sync broke (e.g. a broken PX·IDX means the symbol decoupled from the broad market)
Multi-timeframe usage: read the big-picture coherence state on the higher timeframe (4H), then catch opportunities on decoupling alerts on the lower one (15m–1H)
⚠️ Important Notes
Alt/index must be set: this requires proper correlated-asset/index symbols; unrelated variables break synchrony detection
On the quantum analogy: "entanglement" and "coherence" are metaphors from quantum mechanics, not actual quantum effects; the essence is detecting statistical synchrony among variables
Initial learning period: right after launch the network buffer and baseline are immature; treat entanglement estimates as low-confidence until it learns (several hundred bars)
Decoupling ≠ direction: a break signals an opportunity exists, not a direction (buy/sell); which variable leads needs separate analysis
request.security constraints: alt/index are fetched on the same timeframe; liquidity or timeframe mismatch can make synchrony estimates inaccurate
Adaptive-system nature: historical and live behavior can differ — always forward-test
Constraints: this is a lightweight implementation within Pine's compute budget
🚨 Disclaimer
This indicator is an analytical and educational visualization tool. The entanglement detection, coupling analysis, decoherence judgment, and circular radar are quantitative heuristics computed on-chart from price data — they are not financial advice, buy/sell signals, or any guarantee of future performance. Synchrony-break detection can produce false positives. Always combine any tool with your own analysis and disciplined risk management.
A detector built on a "quantum entanglement" analogy. In entanglement, the states of several particles are so correlated that measuring one instantly informs the others. This engine transposes that onto markets: it measures the synchrony (entanglement strength) among several market variables — price, volume, and one or two correlated assets / global indices — and watches for decoherence, the moment that synchrony breaks down (a decoupling). A NeuraLib map weighs the pairwise couplings into a single Entanglement score, while a self-learning baseline distinguishes "normal" coupling from genuine breaks. Decoupling events — when the system falls out of its entangled state — are flagged as opportunity (divergence, regime shift). Visualization: a circular radar of Entanglement strength radiating from a center node to each variable, with alerts when synchrony collapses.
🔶 Key Features
Quantum-entanglement analogy — quantifies multi-variable synchrony as "entanglement strength"
Pairwise coupling detection — measures four links: price×volume, price×alt, price×index, alt×index
NeuraLib entanglement map — nonlinearly weights the couplings into a unified Entanglement score
Self-learning baseline — learns the "normal" synchrony level to judge genuine collapses by deviation
Decoherence detection — flags decoupling (opportunity) when entanglement drops sharply below baseline
Coherence/decoherence state — distinguishes synchronized (coherent) from collapsed (decoherent)
Circular entanglement radar — radial spokes from a center node to each coupling (length/color by strength) plus concentric rings
Intelligence panel — entanglement, baseline, decoupling magnitude, and each coupling strength at a glance
🧠 Technical Architecture
The engine pulls in a correlated asset and a global index via request.security and forms the "states" of four variables (price return, volume anomaly, alt return, index return).
As pairwise couplings, it computes the absolute rolling correlation |corr|∈[0,1] over four pairs (PX·VOL, PX·ALT, PX·IDX, ALT·IDX) — the strength of each "entanglement link." When all links are strong, the system is synchronized (high entanglement).
The NeuraLib entanglement map (couplings(4) → hidden(tanh) → entanglement strength(1, squashed to [0,1])) nonlinearly weights the couplings into a unified score. The target is the system-wide mean coupling (a self-supervised synchrony measure), and the network learns a smoothed, weighted estimate generalizing the raw mean.
For decoherence, it measures the drop from entanglement's self-learning baseline (a slow EMA tracking the "normal" level): baseline − current. When this clears the threshold, it flags decoupling. The key is catching deviation from the synchrony the system usually holds — not just low correlation.
The circular radar computes coordinates via math.cos/math.sin, drawing spokes from the center node to each coupling link with length proportional to coupling strength. Spoke color shifts with strength (red = collapse → cyan = sync), and concentric rings (25/50/75/100%) mark the scale.
⚙️ Recommended Settings & Tuning Guide
BTC (main) + ETH + TOTAL (1H–4H): Entanglement Window 40, Coherence 0.65, Decoherence 0.35 — a crypto setup
ETH (main) + BTC + TOTAL (1H–4H): BTC as the alt, the broad crypto market as the index
Stock (main) + peer + SPX/index: for single-stock coupling and decoupling detection
SOL (15m–1H): High volatility favors Entanglement Smoothing 5–6 to smooth, Decoherence Threshold 0.4 to be strict
Entanglement Window: longer is a steadier synchrony estimate; shorter is nimbler — ~40 is practical
Coherence Level: above this is "strong sync" — set to the group's typical correlation
Decoherence Threshold: a drop below baseline beyond this is decoupling; smaller is more sensitive (earlier warning)
Choice of alt/index: pick economically coupled assets/indices for detection accuracy
💡 How to Use in Practice
Reacting to decoupling alerts: a ⚡DECOUPLING marker is the moment usually-synced variables break apart — an opportunity for divergence trades or regime shifts; the broken variable may be "leading"
Reading the circular radar: a long, bright (cyan) spoke = strong coupling (synced); short, red = weak (collapsed). All spokes long = system-wide high entanglement; some short = partial decoupling
Using the coherence state: in COHERENT conditions the market moves as one (risk-on/off) and trends propagate; in DECOHERENT conditions idiosyncratic factors dominate, favoring selection and pair trades
Comparing to baseline: when panel entanglement is far below baseline, that's an abnormal break — judge deviation against the usual synchrony
Which coupling broke: the per-coupling rows (PX·VOL, etc.) identify which pair's sync broke (e.g. a broken PX·IDX means the symbol decoupled from the broad market)
Multi-timeframe usage: read the big-picture coherence state on the higher timeframe (4H), then catch opportunities on decoupling alerts on the lower one (15m–1H)
⚠️ Important Notes
Alt/index must be set: this requires proper correlated-asset/index symbols; unrelated variables break synchrony detection
On the quantum analogy: "entanglement" and "coherence" are metaphors from quantum mechanics, not actual quantum effects; the essence is detecting statistical synchrony among variables
Initial learning period: right after launch the network buffer and baseline are immature; treat entanglement estimates as low-confidence until it learns (several hundred bars)
Decoupling ≠ direction: a break signals an opportunity exists, not a direction (buy/sell); which variable leads needs separate analysis
request.security constraints: alt/index are fetched on the same timeframe; liquidity or timeframe mismatch can make synchrony estimates inaccurate
Adaptive-system nature: historical and live behavior can differ — always forward-test
Constraints: this is a lightweight implementation within Pine's compute budget
🚨 Disclaimer
This indicator is an analytical and educational visualization tool. The entanglement detection, coupling analysis, decoherence judgment, and circular radar are quantitative heuristics computed on-chart from price data — they are not financial advice, buy/sell signals, or any guarantee of future performance. Synchrony-break detection can produce false positives. Always combine any tool with your own analysis and disciplined risk management.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.