OPEN-SOURCE SCRIPT
Directional Comparisons - Two Tickers

📊 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.
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.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน