OPEN-SOURCE SCRIPT
Broad Market for Crypto + index

# Broad Market Indicator for Crypto
## Overview
The Broad Market Indicator for Crypto helps traders assess the strength and divergence of individual cryptocurrency assets relative to the overall market. By comparing price deviations across multiple assets, this indicator reveals whether a specific coin is moving in sync with or diverging from the broader crypto market trend.
## How It Works
This indicator calculates percentage deviations from simple moving averages (SMA) for both individual assets and an equal-weighted market index. The core methodology:
1. **Deviation Calculation**: For each asset, the indicator measures how far the current price has moved from its SMA over a specified lookback period (default: 24 hours). The deviation is expressed as a percentage: `(Current Price - SMA) / SMA × 100`
2. **Market Index Construction**: An equal-weighted index is built from selected cryptocurrencies (up to 15 assets). The default composition includes major crypto assets: BTC, ETH, BNB, SOL, XRP, ADA, AVAX, LINK, DOGE, and TRX.
3. **Comparative Analysis**: The indicator displays both the current instrument's deviation and the market index deviation on the same panel, making it easy to spot relative strength or weakness.
## Key Features
- **Customizable Asset Selection**: Choose up to 15 different cryptocurrencies to include in your market index
- **Flexible Configuration**: Toggle individual assets on/off for display and index calculation
- **Current Instrument Tracking**: Automatically plots the deviation of whatever chart you're viewing
- **Visual Clarity**: Color-coded lines for easy differentiation between assets, with the market index shown as a filled area
- **Adjustable Lookback Period**: Modify the SMA period to match your trading timeframe
## How to Use
### Identifying Market Divergences
- When the current instrument deviates significantly above the index, it shows relative strength
- When it deviates below, it indicates relative weakness
- Assets clustering around zero suggest neutral market conditions
### Trend Confirmation
- If both the index and your asset are rising together (positive deviation), it confirms a broad market uptrend
- Divergence between asset and index can signal unique fundamental factors or early trend changes
### Entry/Exit Signals
- Extreme deviations from the index may indicate overbought/oversold conditions relative to the market
- Convergence back toward the index line can signal mean reversion opportunities
## Settings
- **Lookback Period**: Adjust the SMA calculation period (default: 24 hours)
- **Asset Configuration**: Select which cryptocurrencies to monitor and include in the index
- **Display Options**: Show/hide individual assets, current instrument, and market index
- **Color Customization**: Personalize colors for better visual analysis
## Best Practices
- Use on higher timeframes (4H, Daily) for more reliable signals
- Combine with volume analysis for confirmation
- Consider fundamental news when assets show extreme divergence
- Adjust the asset basket to match your trading focus (DeFi, L1s, memecoins, etc.)
## Technical Notes
- The indicator uses `request.security()` to fetch data from multiple symbols
- Deviations are calculated independently for each asset
- The zero line represents perfect alignment with the moving average
- Index calculation automatically adjusts based on active assets
## Default Assets
1. BTC (Bitcoin) - BINANCE:BTCUSDT
2. ETH (Ethereum) - BINANCE:ETHUSDT
3. BNB (Binance Coin) - BINANCE:BNBUSDT
4. SOL (Solana) - BINANCE:SOLUSDT
5. XRP (Ripple) - BINANCE:XRPUSDT
6. ADA (Cardano) - BINANCE:ADAUSDT
7. AVAX (Avalanche) - BINANCE:AVAXUSDT
8. LINK (Chainlink) - BINANCE:LINKUSDT
9. DOGE (Dogecoin) - BINANCE:DOGEUSDT
10. TRX (Tron) - BINANCE:TRXUSDT
Additional slots (11-15) are available for custom asset selection.
---
This indicator is particularly useful for cryptocurrency traders seeking to understand market breadth and identify opportunities where specific assets are diverging from overall market sentiment.
## Overview
The Broad Market Indicator for Crypto helps traders assess the strength and divergence of individual cryptocurrency assets relative to the overall market. By comparing price deviations across multiple assets, this indicator reveals whether a specific coin is moving in sync with or diverging from the broader crypto market trend.
## How It Works
This indicator calculates percentage deviations from simple moving averages (SMA) for both individual assets and an equal-weighted market index. The core methodology:
1. **Deviation Calculation**: For each asset, the indicator measures how far the current price has moved from its SMA over a specified lookback period (default: 24 hours). The deviation is expressed as a percentage: `(Current Price - SMA) / SMA × 100`
2. **Market Index Construction**: An equal-weighted index is built from selected cryptocurrencies (up to 15 assets). The default composition includes major crypto assets: BTC, ETH, BNB, SOL, XRP, ADA, AVAX, LINK, DOGE, and TRX.
3. **Comparative Analysis**: The indicator displays both the current instrument's deviation and the market index deviation on the same panel, making it easy to spot relative strength or weakness.
## Key Features
- **Customizable Asset Selection**: Choose up to 15 different cryptocurrencies to include in your market index
- **Flexible Configuration**: Toggle individual assets on/off for display and index calculation
- **Current Instrument Tracking**: Automatically plots the deviation of whatever chart you're viewing
- **Visual Clarity**: Color-coded lines for easy differentiation between assets, with the market index shown as a filled area
- **Adjustable Lookback Period**: Modify the SMA period to match your trading timeframe
## How to Use
### Identifying Market Divergences
- When the current instrument deviates significantly above the index, it shows relative strength
- When it deviates below, it indicates relative weakness
- Assets clustering around zero suggest neutral market conditions
### Trend Confirmation
- If both the index and your asset are rising together (positive deviation), it confirms a broad market uptrend
- Divergence between asset and index can signal unique fundamental factors or early trend changes
### Entry/Exit Signals
- Extreme deviations from the index may indicate overbought/oversold conditions relative to the market
- Convergence back toward the index line can signal mean reversion opportunities
## Settings
- **Lookback Period**: Adjust the SMA calculation period (default: 24 hours)
- **Asset Configuration**: Select which cryptocurrencies to monitor and include in the index
- **Display Options**: Show/hide individual assets, current instrument, and market index
- **Color Customization**: Personalize colors for better visual analysis
## Best Practices
- Use on higher timeframes (4H, Daily) for more reliable signals
- Combine with volume analysis for confirmation
- Consider fundamental news when assets show extreme divergence
- Adjust the asset basket to match your trading focus (DeFi, L1s, memecoins, etc.)
## Technical Notes
- The indicator uses `request.security()` to fetch data from multiple symbols
- Deviations are calculated independently for each asset
- The zero line represents perfect alignment with the moving average
- Index calculation automatically adjusts based on active assets
## Default Assets
1. BTC (Bitcoin) - BINANCE:BTCUSDT
2. ETH (Ethereum) - BINANCE:ETHUSDT
3. BNB (Binance Coin) - BINANCE:BNBUSDT
4. SOL (Solana) - BINANCE:SOLUSDT
5. XRP (Ripple) - BINANCE:XRPUSDT
6. ADA (Cardano) - BINANCE:ADAUSDT
7. AVAX (Avalanche) - BINANCE:AVAXUSDT
8. LINK (Chainlink) - BINANCE:LINKUSDT
9. DOGE (Dogecoin) - BINANCE:DOGEUSDT
10. TRX (Tron) - BINANCE:TRXUSDT
Additional slots (11-15) are available for custom asset selection.
---
This indicator is particularly useful for cryptocurrency traders seeking to understand market breadth and identify opportunities where specific assets are diverging from overall market sentiment.
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.