OPEN-SOURCE SCRIPT
업데이트됨 RiskGauge

**RISKGAUGE — Universal Asset Risk Thermometer**
Answers one question: "How dangerous is it to be long this asset right now?"
Works on any asset — crypto, stocks, forex, commodities. Blends five independent risk dimensions into a single 0-100 composite score displayed as a color-coded histogram. All components are asset-agnostic and compute from price, volume, and volatility data available on any chart.
**RISK ZONES (Fear & Greed style):**
Score 0-30 = LOW (white). Deep value territory. Price is depressed relative to its own history, momentum is oversold across timeframes, volatility is compressed, and volume pressure is washed out. This is where generational bottoms form. The rubber band is fully loaded for a snap-back.
Score 31-44 = MODERATE (yellow). Below-average risk. Accumulation conditions may be present. Price is below key moving averages, oscillators are neutral-to-cool, and volume is not yet building aggressively. Fear is present but not extreme.
Score 45-54 = ELEVATED (orange). Neutral zone. Risk metrics are mixed — neither a clear buy nor a clear sell from a risk perspective. The market is transitioning between regimes. Stay alert for directional resolution.
Score 55-68 = HIGH (red). Above-average risk. Price is extended above moving averages, momentum is hot across daily and weekly timeframes, volume pressure is building, and volatility is expanding. Distribution conditions are forming. Reduce exposure or tighten stops.
Score 69-100 = EXTREME (deep red). Blow-off territory. Multiple risk metrics are simultaneously overheated. Historically where cycle tops and parabolic reversals cluster. Maximum caution warranted. This is where the crowd is most euphoric and most vulnerable.
**THE FIVE COMPONENTS:**
1. CYCLE POSITION (default 25 pts) — Where is price in its macro range? Measures price vs 200-day SMA ratio (60% weight) and percentile rank of price within its N-day range (40% weight, default 200 bars). When price is far above the 200 SMA and near the top of its historical range, cycle risk is high. When price is deep below the 200 SMA and near multi-year lows, cycle risk is low. The SMA ratio normalizes across the 0.7x to 1.3x range, covering most asset cycles.
2. VOLUME PRESSURE (default 25 pts) — Is buying or selling pressure building? Combines three sub-metrics: relative volume (current volume vs 20-bar SMA, 40% weight), volume momentum (rate of change of the volume SMA over 10 bars, percentile ranked, 30% weight), and Chaikin Money Flow (accumulation/distribution flow over 20 bars, 30% weight). High relative volume with accelerating momentum and positive money flow at extended prices signals a crowded, vulnerable market.
3. MOMENTUM EXHAUSTION (default 25 pts) — Are oscillators overheated across multiple timeframes? Blends RSI percentile rank from the current chart timeframe (30%), daily RSI percentile (35%), and weekly RSI percentile (20%), plus Fisher Transform (15%). Each RSI is ranked against its own 200-bar history via percentile rank. When all three timeframes show elevated percentile simultaneously, momentum exhaustion is high. The multi-timeframe approach prevents false readings from single-timeframe noise.
4. VOLATILITY REGIME (default 25 pts) — Is the market coiled or extended? Combines Bollinger Band Width percentile (35%), ATR percentile (35%), and annualized Realized Volatility percentile (30%), each ranked over a 100-bar lookback. Realized volatility is computed from daily log returns via request.security, ensuring correct annualization regardless of chart timeframe (uses sqrt(365) for crypto and sqrt(252) for stocks, auto-detected). High volatility expansion often precedes reversals. Compressed volatility signals a big move is loading.
5. RELATIVE STRENGTH (default 0 pts, adjustable) — How is this asset performing vs its benchmark? Auto-detects the appropriate benchmark: crypto altcoins measure against BTC (INDEX:BTCUSD), stocks measure against SPX (SP:SPX), BTC itself skips this component entirely. A custom benchmark ticker can also be specified manually. Measures excess return (asset return minus benchmark return) over a configurable lookback (default 50 bars), then percentile ranks the result. When the asset massively outperforms its benchmark, risk of mean-reversion increases. Set weight to 25 and reduce other weights to 18.75 each when using this component. The excess return method avoids the extreme values that ratio-based relative strength can produce when the benchmark is flat.
**VISUAL ELEMENTS:**
Histogram bars show the composite score colored by the current risk zone — white for LOW, yellow for MODERATE, orange for ELEVATED, red for HIGH, and deep red for EXTREME. A smoothed white EMA line (8-bar) overlays the histogram for trend context. Subtle background shading matches the current zone. Horizontal dotted reference lines mark zone boundaries at 31, 45, 55, and 69, with a solid midline at 50.
The component table shows each dimension's raw 0-100 normalized score (zone-colored) and its weighted point contribution. Additional rows display the 200-day SMA ratio, daily RSI, weekly RSI, and chart timeframe RSI, all zone-colored. A direction arrow in the header (3-bar EMA slope) shows whether composite risk is rising or falling. The bottom row displays the total weight sum with a warning indicator if weights do not sum to 100.
**ALERTS:**
Eight symmetric zone-crossing alerts cover every boundary transition: entering and leaving EXTREME (69), entering and leaving HIGH (55), entering and leaving ELEVATED (45), entering MODERATE (31), and entering LOW (below 31). Set these on the daily chart for macro risk notifications.
**ASSET COMPATIBILITY:**
RiskGauge works on any asset with price and volume data. Crypto assets are auto-detected via syminfo.type, currency (USDT/BUSD), and ticker patterns. Stock assets default to SPX as the relative strength benchmark. The realized volatility component auto-adjusts its annualization factor (365 for crypto, 252 for equities). BTC is detected and skips the relative strength component since it IS the crypto benchmark. For BTC-specific on-chain risk analysis (MVRV, leverage, funding, STH basis), use the companion BTC RiskGauge indicator which includes those dedicated data feeds.
**BEST PRACTICES:**
Run on daily for the most coherent read where all components update at the same cadence. Works on any timeframe — higher-timeframe RSI and SMA data are pulled via request.security with confirmed (non-repainting) values. The composite smoothing EMA is adjustable (default 3). All component weights are independently configurable and auto-normalized to 100 so the composite score always uses the full 0-100 range regardless of weight distribution.
Answers one question: "How dangerous is it to be long this asset right now?"
Works on any asset — crypto, stocks, forex, commodities. Blends five independent risk dimensions into a single 0-100 composite score displayed as a color-coded histogram. All components are asset-agnostic and compute from price, volume, and volatility data available on any chart.
**RISK ZONES (Fear & Greed style):**
Score 0-30 = LOW (white). Deep value territory. Price is depressed relative to its own history, momentum is oversold across timeframes, volatility is compressed, and volume pressure is washed out. This is where generational bottoms form. The rubber band is fully loaded for a snap-back.
Score 31-44 = MODERATE (yellow). Below-average risk. Accumulation conditions may be present. Price is below key moving averages, oscillators are neutral-to-cool, and volume is not yet building aggressively. Fear is present but not extreme.
Score 45-54 = ELEVATED (orange). Neutral zone. Risk metrics are mixed — neither a clear buy nor a clear sell from a risk perspective. The market is transitioning between regimes. Stay alert for directional resolution.
Score 55-68 = HIGH (red). Above-average risk. Price is extended above moving averages, momentum is hot across daily and weekly timeframes, volume pressure is building, and volatility is expanding. Distribution conditions are forming. Reduce exposure or tighten stops.
Score 69-100 = EXTREME (deep red). Blow-off territory. Multiple risk metrics are simultaneously overheated. Historically where cycle tops and parabolic reversals cluster. Maximum caution warranted. This is where the crowd is most euphoric and most vulnerable.
**THE FIVE COMPONENTS:**
1. CYCLE POSITION (default 25 pts) — Where is price in its macro range? Measures price vs 200-day SMA ratio (60% weight) and percentile rank of price within its N-day range (40% weight, default 200 bars). When price is far above the 200 SMA and near the top of its historical range, cycle risk is high. When price is deep below the 200 SMA and near multi-year lows, cycle risk is low. The SMA ratio normalizes across the 0.7x to 1.3x range, covering most asset cycles.
2. VOLUME PRESSURE (default 25 pts) — Is buying or selling pressure building? Combines three sub-metrics: relative volume (current volume vs 20-bar SMA, 40% weight), volume momentum (rate of change of the volume SMA over 10 bars, percentile ranked, 30% weight), and Chaikin Money Flow (accumulation/distribution flow over 20 bars, 30% weight). High relative volume with accelerating momentum and positive money flow at extended prices signals a crowded, vulnerable market.
3. MOMENTUM EXHAUSTION (default 25 pts) — Are oscillators overheated across multiple timeframes? Blends RSI percentile rank from the current chart timeframe (30%), daily RSI percentile (35%), and weekly RSI percentile (20%), plus Fisher Transform (15%). Each RSI is ranked against its own 200-bar history via percentile rank. When all three timeframes show elevated percentile simultaneously, momentum exhaustion is high. The multi-timeframe approach prevents false readings from single-timeframe noise.
4. VOLATILITY REGIME (default 25 pts) — Is the market coiled or extended? Combines Bollinger Band Width percentile (35%), ATR percentile (35%), and annualized Realized Volatility percentile (30%), each ranked over a 100-bar lookback. Realized volatility is computed from daily log returns via request.security, ensuring correct annualization regardless of chart timeframe (uses sqrt(365) for crypto and sqrt(252) for stocks, auto-detected). High volatility expansion often precedes reversals. Compressed volatility signals a big move is loading.
5. RELATIVE STRENGTH (default 0 pts, adjustable) — How is this asset performing vs its benchmark? Auto-detects the appropriate benchmark: crypto altcoins measure against BTC (INDEX:BTCUSD), stocks measure against SPX (SP:SPX), BTC itself skips this component entirely. A custom benchmark ticker can also be specified manually. Measures excess return (asset return minus benchmark return) over a configurable lookback (default 50 bars), then percentile ranks the result. When the asset massively outperforms its benchmark, risk of mean-reversion increases. Set weight to 25 and reduce other weights to 18.75 each when using this component. The excess return method avoids the extreme values that ratio-based relative strength can produce when the benchmark is flat.
**VISUAL ELEMENTS:**
Histogram bars show the composite score colored by the current risk zone — white for LOW, yellow for MODERATE, orange for ELEVATED, red for HIGH, and deep red for EXTREME. A smoothed white EMA line (8-bar) overlays the histogram for trend context. Subtle background shading matches the current zone. Horizontal dotted reference lines mark zone boundaries at 31, 45, 55, and 69, with a solid midline at 50.
The component table shows each dimension's raw 0-100 normalized score (zone-colored) and its weighted point contribution. Additional rows display the 200-day SMA ratio, daily RSI, weekly RSI, and chart timeframe RSI, all zone-colored. A direction arrow in the header (3-bar EMA slope) shows whether composite risk is rising or falling. The bottom row displays the total weight sum with a warning indicator if weights do not sum to 100.
**ALERTS:**
Eight symmetric zone-crossing alerts cover every boundary transition: entering and leaving EXTREME (69), entering and leaving HIGH (55), entering and leaving ELEVATED (45), entering MODERATE (31), and entering LOW (below 31). Set these on the daily chart for macro risk notifications.
**ASSET COMPATIBILITY:**
RiskGauge works on any asset with price and volume data. Crypto assets are auto-detected via syminfo.type, currency (USDT/BUSD), and ticker patterns. Stock assets default to SPX as the relative strength benchmark. The realized volatility component auto-adjusts its annualization factor (365 for crypto, 252 for equities). BTC is detected and skips the relative strength component since it IS the crypto benchmark. For BTC-specific on-chain risk analysis (MVRV, leverage, funding, STH basis), use the companion BTC RiskGauge indicator which includes those dedicated data feeds.
**BEST PRACTICES:**
Run on daily for the most coherent read where all components update at the same cadence. Works on any timeframe — higher-timeframe RSI and SMA data are pulled via request.security with confirmed (non-repainting) values. The composite smoothing EMA is adjustable (default 3). All component weights are independently configurable and auto-normalized to 100 so the composite score always uses the full 0-100 range regardless of weight distribution.
릴리즈 노트
Cosmetic릴리즈 노트
cosmetic오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.