OPEN-SOURCE SCRIPT
已更新

Trading Toolkit - Comprehensive Analysis

994
Trading Toolkit – Comprehensive Analysis
A unified trading analysis toolkit with four sections:
📊 Company Info
Fundamentals, market cap, sector, and earnings countdown.
📅 Performance
Date‑range analysis with key metrics.
🎯 Market Sentiment
CNN‑style Fear & Greed Index (7 components) + 150‑SMA positioning.
🛡️ Risk Levels
ATR/MAD‑based stop‑loss and take‑profit calculations.

Key Features

CNN‑style Fear & Greed approximation using:

Momentum: S&P 500 vs 125‑DMA
Price Strength: NYSE 52‑week highs vs lows
Market Breadth: McClellan Volume Summation (Up/Down volume)
Put/Call Ratio: 5‑day average (inverted)
Volatility: VIX vs 50‑DMA (inverted)
Safe‑Haven Demand: 20‑day SPY–IEF return spread
Junk‑Bond Demand: HY vs IG credit spread (inverted)


Normalization: z‑score → percentile (0–100) with ±3 clipping.
CNN‑aligned thresholds:
Extreme Fear: 0–24 | Fear: 25–44 | Neutral: 45–54 | Greed: 55–74 | Extreme Greed: 75+.
Risk tools: ATR & MAD volatility measures with configurable multipliers.
Flexible layout: vertical or side‑by‑side columns.


Data Sources

S&P 500: CBOE:SPX or AMEX:SPY
NYSE: INDEX:HIGN, INDEX:LOWN, USI:UVOL, USI:DVOL
Options: USI:PCC (Total PCR), fallback INDEX:CPCS (Equity PCR)
Volatility: CBOE:VIX
Treasuries: NASDAQ:IEF
Credit Spreads: FRED:BAMLH0A0HYM2, FRED:BAMLC0A0CM


Risk Management

ATR risk bands: 🟢 ≤3%, 🟡 3–6%, ⚪ 6–10%, 🟠 10–15%, 🔴 >15%
MAD‑based stop‑loss and take‑profit calculations.


Author: Daniel Dahan
(AI Generated, Merged & enhanced version with CNN‑style Fear & Greed)
發行說明
Added P/E ratio & beta
發行說明
📊 Trading Toolkit v2.0 - Major Feature Update
🆕 New Features Added:
1. F&G Acceleration & Trend Analysis

Real-time Fear & Greed momentum tracking with 5-state classification (Strong Up/Up/Flat/Down/Strong Down)
Z-score normalized acceleration analysis with configurable parameters
Color-coded trend indicators with emoji visualization

2. Professional Position Sizing

Portfolio-based position sizing with configurable risk percentage (default 1%)
ATR/MAD-based stop distance calculations
Displays both position value % and actual risk % for clarity
Automatic position limits to prevent over-allocation

3. F&G-Driven Leverage Policy

Dynamic leverage recommendations (0-100%+) based on Fear & Greed sentiment
Dual calculation methods: Sigmoid (smooth curve) vs Piecewise (linear segments)
Acceleration-based adjustments for momentum timing
Visual indicators showing method and acceleration state

🎨 Display Improvements:

Enhanced Market Sentiment section with acceleration states
Consistent text color configuration across all indicators
Emoji-based visual feedback (🟢🟡🟠🔴⚪) for trend and leverage states
Optional trend color override for advanced users

🔧 Technical Enhancements:
Custom slope calculation function for trend analysis
Robust fallback calculations for missing data
Improved code consistency and Pine Script v5 compliance
Comprehensive input parameter organization

Perfect for traders seeking advanced risk management and sentiment-driven position sizing!

Compatible with existing configurations. All new features can be toggled on/off independently.
發行說明
🔧 Critical Fix: S&P 500 Data Consistency
Fixed S&P 500 Fear & Greed Index and SPX-based leverage recommendations incorrectly changing when switching between stocks.

Root cause: Market-wide data sources were using configurable timeframes instead of hardcoded daily timeframes. Now all S&P 500 components (VIX, NYSE data, Put/Call ratios, etc.) use consistent daily data regardless of chart timeframe or stock symbol.

Result: S&P 500 indicators now remain constant across all stocks as intended, while individual stock metrics still update appropriately.
發行說明
updating the chart
發行說明
trying again to update the chart
發行說明
3rd time a charm
發行說明
trying to make Trading View to update the chart
發行說明
another try
發行說明
updated the Risk section name

免責聲明

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.