OPEN-SOURCE SCRIPT

Momentum Grid 2.1 + Top Stocks

75
📊 MOMENTUM GRID 2.1 + TOP STOCKS

Overview
A multi-timeframe confirmation system specifically designed for NIFTY 50 and BANK NIFTY index options trading. This script combines 8 independent technical indicators into a weighted scoring model to generate high-probability CE (Call) and PE (Put) signals, while simultaneously tracking the top 5 constituent stocks for sector-wide momentum validation.
________________________________________
🎯 Core Methodology
1. 8-Factor Confirmation System
Unlike traditional single-indicator approaches, this script requires multiple confirmations before generating signals. Each factor votes independently:
Trend Alignment (3 votes):
• C1: Price above/below EMA 9 (immediate trend)
• C2: EMA 9 above/below EMA 20 (short-term momentum)
• C3: EMA 20 above/below EMA 50 (intermediate trend)
Oscillator Confirmation (3 votes):
• C4: RSI above/below 50 (momentum strength)
• C5: Stochastic K above/below D (entry timing)
• C6: MACD Histogram positive/negative (momentum direction)
Advanced Momentum (2 votes):
• C7: Parabolic SAR position (trend continuation)
• C8: Squeeze Momentum direction (volatility expansion)
Mathematical Logic:
Bullish Score = C1 + C2 + C3 + C4 + C5 + C6 + C7 + C8
Signal Triggered when Score ≥ Threshold (default: 5/8)
Why This Works: By requiring 5+ confirmations, the script filters out false signals that occur when only 1-2 indicators align by chance. This dramatically reduces whipsaws in choppy markets.
________________________________________
📈 Constituent Stock Analysis System
Real-Time Top 5 Stocks Tracking
The script fetches live data from the most heavily-weighted stocks in the selected index:
NIFTY 50 Constituents:
• Reliance Industries
• HDFC Bank
• Infosys
• ICICI Bank
• TCS
BANK NIFTY Constituents:
• HDFC Bank
• ICICI Bank
• Kotak Mahindra Bank
• State Bank of India
• Axis Bank
Stock Scoring Algorithm (0-6 Scale):
For each stock, the script calculates a momentum score based on:
1. Price vs EMA 9 position
2. EMA 9 vs EMA 20 relationship
3. EMA 20 vs EMA 50 hierarchy
4. RSI above/below 50
5. MACD histogram direction
6. Intraday price change direction
Signal Interpretation:
• 🚀🔥 Strong Bullish: Score ≥5 + Day Change >0.5%
• ⚠️❄️ Strong Bearish: Score ≤1 + Day Change <-0.5%
• 📈 Moderate Bullish: Score ≥3 + Positive change
• 📉 Moderate Bearish: Score ≤3 + Negative change
Why Track Constituents?
Index options are a weighted average of their components. When 4 out of 5 top stocks show strong bullish signals but the index signal is neutral, it indicates:
• Sector rotation is happening
• Underlying strength not yet reflected in index
• Early warning for potential index breakout
________________________________________
🎨 Visual Dashboard System
1. Main Momentum Grid (Middle Right)
Real-time status of all 8 confirmation factors:
• Individual indicator values
• Bullish/Bearish status per indicator
• Cumulative Bull Score and Bear Score
• Visual color coding (Green = Bullish, Red = Bearish)
2. Top Stocks Status Panel (Top Right)
Live tracking table showing:
• LTP (Last Traded Price): Current stock price
• Day Change %: Intraday movement from open
• Status: Overall bullish/bearish trend
• EMA Status: Position relative to EMA 9
• Signal Emoji: Visual strength indicator
3. Scenario Guide (Bottom Right)
Auto-calculates trade parameters based on current signal:
• Side: CE (Call) or PE (Put) recommendation
• Strike Reference: Current index price
• Trigger Level: Entry confirmation level (high/low of signal bar)
• Risk Limit: Stop loss using 1.5x ATR
• Price Objective: Target using 2.5x ATR
ATR-Based Risk Management: Average True Range (14-period) adapts stop-loss and targets to current volatility, ensuring consistent risk-reward ratios across different market conditions.
________________________________________
🚨 Signal Generation Logic
CE (Call) Signal Triggers When:
1. Bullish Score ≥ Threshold (5/8 default)
2. Previous bar Bullish Score < Threshold
3. Confirmation candle closes above EMA 9
4. Background turns light green
PE (Put) Signal Triggers When:
1. Bearish Score ≥ Threshold (5/8 default)
2. Previous bar Bearish Score < Threshold
3. Confirmation candle closes below EMA 9
4. Background turns light red
Signal Validation: Labels appear only when a new qualifying bar completes, preventing repainting. The tooltip shows the exact score and entry price for record-keeping.
________________________________________
🔧 Customization Options
Parameter Purpose Recommendation
Index Selection Choose NIFTY 50 or BANK NIFTY Match to your trading instrument
EMA Periods Adjust trend sensitivity Default (9/20/50/100) suits 5-15 min
Signal Threshold Min confirmations required 5/8 (balanced), 6/8 (conservative)
RSI Length Momentum calculation period 14 (standard), 21 (smoother)
MACD Settings Fast/Slow/Signal periods 12/26/9 (industry standard)
________________________________________
📊 Technical Indicator Details
Exponential Moving Averages (EMA)
• Why EMA vs SMA: Exponential weighting gives more importance to recent price action, making it more responsive to trend changes in fast-moving index options.
Relative Strength Index (RSI)
• Measures momentum on 0-100 scale
• 50 level acts as bull/bear dividing line
• Used for confirmation, not overbought/oversold
Stochastic Oscillator
• Compares closing price to recent range
• K line crossing above D line = bullish momentum shift
• Sensitive to short-term reversals
MACD (Moving Average Convergence Divergence)
• Histogram shows momentum acceleration/deceleration
• Positive histogram = increasing bullish momentum
• Used as tiebreaker when other signals conflict
Parabolic SAR
• Tracks stop-and-reverse points
• Dots below price = uptrend, above = downtrend
• Adds trend-following confirmation
Squeeze Momentum
• Identifies periods of low volatility (consolidation)
• Bollinger Bands inside Keltner Channels = "squeeze"
• Positive momentum during squeeze = bullish breakout setup
________________________________________
💡 What Makes This Script Unique
1. Index-Specific Design: Unlike generic multi-timeframe indicators, this is purpose-built for NIFTY/BANKNIFTY options with constituent stock correlation analysis.
2. Multi-Layer Validation: Combines price action (EMAs), momentum (RSI/Stoch/MACD), and volatility (Squeeze) for comprehensive market assessment.
3. Smart Constituent Tracking: Automatically switches stock universe based on selected index, providing sector-level context that single-chart indicators miss.
4. Adaptive Risk Management: ATR-based stop-loss and targets adjust to market volatility automatically, unlike fixed-point systems.
5. No Repainting: All calculations use confirmed bars with lookahead=barmerge.lookahead_off parameter, ensuring historical backtesting accuracy.
________________________________________
📚 Best Practices
Timeframe Selection:
• 5 min: Scalping (high frequency, tight stops)
• 15 min: Intraday swing trades (balanced)
• 1 hour: Positional option trades (overnight holds)
Trade Execution:
1. Wait for CE/PE label to appear
2. Check Top Stocks Status - look for 3+ stocks confirming index direction
3. Verify Scenario Guide shows acceptable risk-reward (min 1:1.5)
4. Enter on next candle open or use trigger level for limit orders
5. Place stop-loss at "Risk Limit" level
6. Scale out at "Price Objective" or trail with Parabolic SAR
False Signal Filters:
• Avoid signals during first 15 minutes of market open (high volatility)
• Skip signals when Top Stocks show conflicting directions (3 bull, 2 bear)
• Increase threshold to 6/8 during major news events
• Disable trading 30 minutes before important announcements
________________________________________
⚠️ Limitations & Considerations
• Index Options Specific: Optimized for NIFTY/BANKNIFTY - may need recalibration for other instruments
• Not Suitable for Trending Markets: Works best in swing/range conditions; reduce threshold in strong trends
• Constituent Data Dependency: Relies on accurate real-time stock data; verify broker data quality
• Options Greeks Ignored: Script doesn't account for theta decay, IV changes - user must manage option selection
________________________________________
🔔 Built-In Alerts
Set alerts for:
• CE Signal Generated: Bullish score crosses threshold
• PE Signal Generated: Bearish score crosses threshold
Alert messages include ticker symbol and entry price for quick execution.
________________________________________
📈 Performance Optimization Tips
1. Score Correlation Check: If Bull Score and Bear Score are both high (6+/8), market is conflicted - wait for resolution.
2. Stock Divergence Strategy: When 4/5 stocks are bullish but index shows PE signal, it often indicates a false breakdown - counter-trend opportunity.
3. Squeeze Breakout Combo: Strongest signals occur when Squeeze changes from "ON" to "OFF" simultaneously with CE/PE trigger.
4. EMA Stacking: Maximum confidence signals have all three EMAs in proper order (9>20>50 for bull, reverse for bear).
________________________________________
🎓 Educational Context
This methodology synthesizes:
• Multi-Timeframe Analysis: EMAs represent different trend horizons
• Oscillator Convergence: Multiple momentum tools reduce false positives
• Index Arbitrage Concepts: Constituent tracking exploits pricing inefficiencies
• Adaptive Volatility: ATR-based risk scales with market conditions
The 8-factor system mirrors institutional decision frameworks where analysts require consensus across multiple models before position changes.
________________________________________
📋 Quick Reference
Bullish Setup Checklist: ✅ Bull Score ≥ 5/8
✅ Green background color
✅ 3+ top stocks showing 📈 or 🚀
✅ Price above EMA 9
✅ MACD Histogram positive
Bearish Setup Checklist: ✅ Bear Score ≥ 5/8
✅ Red background color
✅ 3+ top stocks showing 📉 or ⚠️
✅ Price below EMA 9
✅ MACD Histogram negative
________________________________________
⚖️ Disclaimer
This indicator is a decision support tool, not an automated trading system. Index options involve substantial risk and can result in total loss of premium paid. The constituent stock analysis provides context but does not guarantee index price movement. Users must:
• Understand options Greeks (delta, theta, vega)
• Use proper position sizing (max 2-3% capital per trade)
• Never trade based on signals alone without market context
• Comply with SEBI regulations and broker policies
Past performance of signals does not guarantee future results.
________________________________________
Version: Pine Script v6
Supported Indices: NIFTY 50, BANK NIFTY
Resource Usage: Moderate (Multi-security data requests)
Update Frequency: Real-time on current timeframe
________________________________________
For support or suggestions, please comment below. If this script helps your trading, please like and follow for updates! 🚀📊

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.