OPEN-SOURCE SCRIPT

Directional Comparisons - Two Tickers

65
📊 Directional Comparisons – Two Tickers
Overview:
This tool allows you to visually and statistically compare the directional behaviour of any two assets on any chart timeframe. It identifies and color-codes each bar based on how both the current asset and your chosen comparison asset performed in that period (e.g., both up, both down, diverging). A statistical summary table dynamically updates in the corner of your chart, tracking the probability and streak performance of each condition.

🛠 How It Works:
Each candle is analysed and color-coded based on the relationship between the current chart's asset and a comparison asset of your choice:

✅ Green – Both tickers closed higher (bullish alignment)

🔻 Red – Both tickers closed lower (bearish alignment)

🔷 Blue – Current ticker up, comparison ticker down (positive divergence)

🟧 Orange – Current ticker down, comparison ticker up (negative divergence)

You can toggle each colour condition on/off independently.

📈 Statistical Table (Top Right):
For the candles in the visible chart range, the indicator displays:

The frequency (probability) of each condition

Longest, shortest, and average streaks for each condition

Average % change for both the current and comparison asset under each scenario

All stats auto-update as you zoom or scroll through the chart.

🔧 User Inputs:
Comparison Ticker: Choose any ticker symbol to compare against the current chart

Toggle Conditions: Enable or disable individual directional conditions (color-coded)

✅ Use Cases:
Spot high-probability alignment zones between two assets (e.g., BTC vs ETH, SPX vs VIX)

Identify divergence opportunities for trading signals

Analyse historical relationships and co-movements between assets

Perform correlation streak studies directly on the chart

🔍 Notes:
The script works across all timeframes (1min to monthly).

Stats only consider visible bars on your chart for responsiveness.

Ideal for pair traders, macro analysts, or anyone interested in cross-asset relationships.

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.