OPEN-SOURCE SCRIPT
Telah dikemas kini Adaptive Correlation Engine (ACE)

🧠 Adaptive Correlation Engine (ACE)
Quantify inter-asset relationships with adaptive lag detection and actionable insights.
📌 What is ACE?
The Adaptive Correlation Engine (ACE) is a precision tool for seeking to uncover meaningful relationships between two assets — not just raw correlation, but also lag dynamics, leader detection, and alignment vs. divergence classification.
Unlike static correlation tools, ACE intelligently scans multiple lag windows to find:
✅ The maximum correlation between the base asset and a comparison symbol
⏱️ The optimal lag (if any) at which the correlation is strongest
🧭 Whether the assets are Aligned (positive correlation) or Divergent (inverse)
🔁 Which symbol is leading, and by how many bars
📈 Actionable signal strength based on a user-defined correlation threshold
⚙️ How It Works
Correlation Scan:
For each bar, ACE checks the correlation between the charted asset (close) and a lagged version of the comparison asset across a sliding window of lookback periods.
Lag Optimization:
The engine searches from lag 0 up to your specified Max Lag to find where the correlation (positive or negative) is most significant.
Relationship Classification:
The indicator classifies the relationship as:
Aligned: Positive correlation above the threshold
Divergent: Negative correlation above the threshold
Synchronous: No lag detected
Low Signal: Correlation is weak or noisy
Visual & Tabular Insights:
ACE plots the highest detected correlation on the chart and shows an insight table displaying:
- Correlation value
- Detected lag
- Direction type (aligned/divergent)
- Leading asset
- Suggested action (e.g., “Likely continuation” or “Possible mean reversion”)
💡 How to Use It
Use ACE to identify leadership patterns between assets (e.g., ETH leads altcoins, SPX leads crypto, etc.)
Spot potential lagging trade setups where one asset’s move may soon echo in another
Confirm or challenge correlation-based trading assumptions with data
Combine with technical indicators or price action to time entries and exits more confidently
🔔 Alerts
Built-in alerts notify you when correlation strength crosses your actionable threshold, classified by alignment or divergence.
🛠️ Inputs
Compare Symbol: The asset to compare against (e.g., INDEX:ETHUSD)
Correlation Lookback: Rolling window for calculating correlation
Max Lag Bars: Maximum lag shift to test
Minimum Actionable Correlation: Signal threshold for trade-worthy insights
⚠️ Disclaimer
This tool is for research and informational purposes only. It does not constitute financial advice or a trading signal. Always perform your own due diligence and consult a financial advisor before making investment decisions.
Quantify inter-asset relationships with adaptive lag detection and actionable insights.
📌 What is ACE?
The Adaptive Correlation Engine (ACE) is a precision tool for seeking to uncover meaningful relationships between two assets — not just raw correlation, but also lag dynamics, leader detection, and alignment vs. divergence classification.
Unlike static correlation tools, ACE intelligently scans multiple lag windows to find:
✅ The maximum correlation between the base asset and a comparison symbol
⏱️ The optimal lag (if any) at which the correlation is strongest
🧭 Whether the assets are Aligned (positive correlation) or Divergent (inverse)
🔁 Which symbol is leading, and by how many bars
📈 Actionable signal strength based on a user-defined correlation threshold
⚙️ How It Works
Correlation Scan:
For each bar, ACE checks the correlation between the charted asset (close) and a lagged version of the comparison asset across a sliding window of lookback periods.
Lag Optimization:
The engine searches from lag 0 up to your specified Max Lag to find where the correlation (positive or negative) is most significant.
Relationship Classification:
The indicator classifies the relationship as:
Aligned: Positive correlation above the threshold
Divergent: Negative correlation above the threshold
Synchronous: No lag detected
Low Signal: Correlation is weak or noisy
Visual & Tabular Insights:
ACE plots the highest detected correlation on the chart and shows an insight table displaying:
- Correlation value
- Detected lag
- Direction type (aligned/divergent)
- Leading asset
- Suggested action (e.g., “Likely continuation” or “Possible mean reversion”)
💡 How to Use It
Use ACE to identify leadership patterns between assets (e.g., ETH leads altcoins, SPX leads crypto, etc.)
Spot potential lagging trade setups where one asset’s move may soon echo in another
Confirm or challenge correlation-based trading assumptions with data
Combine with technical indicators or price action to time entries and exits more confidently
🔔 Alerts
Built-in alerts notify you when correlation strength crosses your actionable threshold, classified by alignment or divergence.
🛠️ Inputs
Compare Symbol: The asset to compare against (e.g., INDEX:ETHUSD)
Correlation Lookback: Rolling window for calculating correlation
Max Lag Bars: Maximum lag shift to test
Minimum Actionable Correlation: Signal threshold for trade-worthy insights
⚠️ Disclaimer
This tool is for research and informational purposes only. It does not constitute financial advice or a trading signal. Always perform your own due diligence and consult a financial advisor before making investment decisions.
Nota Keluaran
overlay=falseNota Keluaran
🔄 Update: Relative Leadership Analysis Added (v1.1)This update adds a powerful new feature to the Adaptive Correlation Engine (ACE):
🧮 Relative Strength Leadership Row
A new row in the insight table now tracks the price ratio (A/B) of the charted asset and the comparison symbol over the selected lookback period. This allows ACE to determine:
Which asset has been stronger (relative outperformance)
By how much, using percentage-based change
Combined with lag-based correlation, this provides deeper confirmation of directional leadership
📊 Example Table Output:
ETHUSD stronger → ETH is outperforming the charted asset
SHIBUSD stronger → Chart asset is leading ETH
Even → Relative performance is flat
🔧 Technical Notes:
Ratio is calculated using close / compare_symbol_close
Change is measured over the same correlation lookback window
Visual cue colors: green = chart asset stronger, red = comparison stronger
✅ This helps you validate correlation-based leadership with actual price behavior, reducing noise and false positives.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.