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.

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.