PROTECTED SOURCE SCRIPT

RED-E Institutional Flow Tracker Pro

156
RED-E Institutional Flow Tracker Pro

A histogram-based institutional activity detector for swing traders and options traders. Identifies institutional buying/selling pressure through volume analysis, money flow calculations, and manipulation detection algorithms.

═══════════════════════════════════════════════════════════════════════════════
OVERVIEW
═══════════════════════════════════════════════════════════════════════════════

This indicator addresses two critical challenges in swing trading:

1. Exiting profitable positions prematurely due to normal market volatility
2. Holding positions during periods of market manipulation

The histogram display provides clear visual signals (BUY/HOLD/SELL) with educational tooltips explaining why each signal appeared and how to trade it.

═══════════════════════════════════════════════════════════════════════════════
ORIGINALITY & METHODOLOGY
═══════════════════════════════════════════════════════════════════════════════

Built from scratch using Pine Script v6, this indicator combines multiple analytical methods into a unified histogram system:

**Core Detection Methods:**

- **Dollar Volume Analysis** - Multiplies price by volume to identify institutional-sized trades. Default threshold: 3x average dollar volume over 20 periods.

- **Smart Money Flow Detection** - Combines three simultaneous conditions: unusual volume (1.5x+ average), large order size (3x+ average dollar volume), and directional price movement. All three must occur on the same bar for confirmation.

- **Money Flow Index Integration** - 14-period volume-weighted momentum indicator. Calculated as: typical price (HLC3) × volume, separated into positive flow (up bars) and negative flow (down bars), converted to 0-100 scale.

- **Manipulation Detection Algorithm** - Identifies suspicious patterns where volume spikes dramatically (>1.5x threshold) but price moves minimally (<0.5% volatility). This pattern is characteristic of spoofing, layering, and wash trading.

- **Market Regime Classification** - Uses Money Flow Index combined with flow strength to classify market state as Bullish (MFI >50 and positive flow), Bearish (MFI <50 and negative flow), or Neutral.

**Histogram Calculation:**

Formula: (Price Change % × Volume Ratio) × (1.5x multiplier if large order detected)
Smoothed with 3-period EMA for clean visualization
Values automatically scaled for optimal display

**21-Period Moving Average:**

Simple moving average of histogram values provides trend direction confirmation. Crossovers signal momentum shifts.

═══════════════════════════════════════════════════════════════════════════════
HOW IT WORKS - TECHNICAL DETAILS
═══════════════════════════════════════════════════════════════════════════════

**1. Volume Analysis Foundation**
- 50-period SMA of volume establishes baseline
- Current volume compared to baseline creates Volume Ratio
- Unusual volume threshold (default 1.5x) flags institutional interest

**2. Money Flow Index (14-period default)**
- Typical price = (High + Low + Close) / 3
- Raw Money Flow = Typical Price × Volume
- Positive Flow = Raw Money Flow when price up
- Negative Flow = Raw Money Flow when price down
- MFI = 100 - [100 / (1 + Positive Flow Sum / Negative Flow Sum)]

**3. Large Order Detection**
- Dollar Volume = Close Price × Volume
- 20-period average establishes baseline
- Orders exceeding 3x baseline flagged as institutional

**4. Smart Money Logic**
- Buying Signal: Positive price change AND large order AND volume >1.5x average (all simultaneous)
- Selling Signal: Negative price change AND large order AND volume >1.5x average (all simultaneous)
- Must occur on same bar for confirmation

**5. Flow Magnitude Tracking**
- Dollar volume tracked cumulatively
- Automatically resets daily at market open
- Formatted in readable units: K (thousands), M (millions), B (billions), T (trillions)
- Displayed in dashboard for easy monitoring

**6. Signal Classification**
- Strong Buy: Histogram >0.3 AND bullish regime AND unusual volume
- Buy: Histogram >0.15 AND bullish regime
- Hold: Histogram between ±0.15 OR neutral regime
- Sell: Histogram <-0.15 AND bearish regime
- Strong Sell: Histogram <-0.3 AND bearish regime AND unusual volume

**7. Manipulation Detection**
- Triggers when: Volume Ratio > threshold AND price volatility < 0.5%
- This pattern suggests large volume without corresponding price impact
- Common in spoofing (fake orders), layering (multiple false orders), and wash trading

═══════════════════════════════════════════════════════════════════════════════
HISTOGRAM DISPLAY & INTERPRETATION
═══════════════════════════════════════════════════════════════════════════════

**Color-Coded Bars:**

- **Bright Green** - Strong institutional buying (>0.3 momentum + bullish regime + unusual volume)
- **Light Green** - Institutional buying (>0.15 momentum + bullish regime)
- **Gray** - Neutral/Hold zone (±0.15 momentum or neutral regime)
- **Light Red** - Institutional selling (<-0.15 momentum + bearish regime)
- **Bright Red** - Strong institutional selling (<-0.3 momentum + bearish regime + unusual volume)

**Visual Signals:**

- **BUY labels** - Appear above bright green bars with detailed tooltip
- **SELL labels** - Appear below bright red bars with detailed tooltip
- **HOLD labels** - Appear on most recent bar during consolidation with educational tooltip
- **Yellow warning dots (⚠)** - Mark manipulation periods at zero line with explanation tooltip
- **Blue 21-period MA** - Shows overall trend direction

**Interactive Tooltips:**

Hover over any signal to see:
- Why the signal appeared (exact metrics)
- What the data shows (momentum, MFI, volume values)
- How to trade it (entry, exit, position sizing)
- Risk management recommendations

**Plot Style Options:**

Users can choose from 5 display styles:
- Columns (default) - Traditional histogram bars
- Area - Filled area chart
- Line - Simple line chart
- Step Line - Step-style line
- Histogram - Alternative histogram style

═══════════════════════════════════════════════════════════════════════════════
DASHBOARD METRICS EXPLAINED
═══════════════════════════════════════════════════════════════════════════════

12-row real-time dashboard displays:

**Current Flow** - Institutional money flow for current bar (M/B/T units)

**Daily Flow** - Cumulative activity since market open (resets daily)

**Flow Strength** - Intensity percentage (0-100%)
- >70% = Extreme pressure
- 40-70% = Moderate activity
- <40% = Weak/absent activity

**Money Flow Index** - Volume-weighted momentum (0-100 scale)
- >60 = Strong buying pressure
- 40-60 = Neutral/mixed
- <40 = Strong selling pressure

**Volume Ratio** - Current vs 50-day average
- >2.0x = Highly unusual
- 1.5-2.0x = Unusual
- <1.5x = Normal

**Market Regime** - Current classification
- Bullish: MFI >50 AND histogram >0
- Bearish: MFI <50 AND histogram <0
- Neutral: All other conditions

**Activity Status** - Real-time assessment
- HEAVY BUYING: Unusual volume + buying + MFI >60
- BUYING: Large orders + positive movement
- HEAVY SELLING: Unusual volume + selling + MFI <40
- SELLING: Large orders + negative movement
- NEUTRAL: No significant activity

**Unusual Volume** - Binary alert when exceeds threshold

**Large Orders** - Binary alert when dollar volume >3x average

**Manipulation Warning** - Binary alert for suspicious patterns

**Swing Signal** - Primary recommendation
- HOLD LONG: Bullish regime + Flow Strength >60%
- HOLD SHORT: Bearish regime + Flow Strength >60%
- CAUTION: Manipulation detected
- MONITOR: All other conditions

═══════════════════════════════════════════════════════════════════════════════
HOW TO USE FOR SWING TRADING
═══════════════════════════════════════════════════════════════════════════════

**ENTRY CONFIRMATION (Long Positions):**

Wait for multiple confirmations:
1. Histogram shows bright green bars
2. Histogram crosses above 21-period MA
3. Flow Strength >60%
4. Dashboard shows "BUYING" or "HEAVY BUYING"
5. Volume Ratio >1.5x
6. No yellow manipulation warnings
7. Regime shows "BULLISH"

**HOLDING POSITIONS (Primary Use Case):**

The indicator's strength is helping traders stay in winning trades. Continue holding when:
- Dashboard displays "HOLD LONG" or "HOLD SHORT"
- Histogram bars remain same color as position direction
- Histogram stays on correct side of 21-period MA
- Daily Flow continues trending in your direction
- Market regime supports position
- No "CAUTION" signals appear

This prevents premature exits during normal volatility when institutions are still supporting the move.

**EXIT SIGNALS:**

Consider closing positions when:
- Histogram crosses 21-period MA against position
- Histogram color changes from green to red (or vice versa)
- Dashboard changes to "CAUTION"
- Yellow manipulation warnings appear
- Market regime flips
- Flow Strength drops below 40%

**ENTRY CONFIRMATION (Short Positions):**

Wait for multiple confirmations:
1. Histogram shows bright red bars
2. Histogram crosses below 21-period MA
3. Flow Strength >60%
4. Dashboard shows "SELLING" or "HEAVY SELLING"
5. Volume Ratio >1.5x
6. No manipulation warnings
7. Regime shows "BEARISH"

═══════════════════════════════════════════════════════════════════════════════
CUSTOMIZATION OPTIONS
═══════════════════════════════════════════════════════════════════════════════

**Flow Detection Settings:**
- Unusual Volume Threshold (1.0-5.0x, default 1.5x)
- Large Order Multiplier (2.0-10.0x, default 3.0x)
- Flow Analysis Period (5-50 bars, default 14)

**Histogram Display:**
- Histogram Style (5 options: Columns/Area/Line/Step/Histogram)
- Histogram Width (1-10, default 4)

**Moving Average:**
- Show 21-Period MA (toggle)
- MA Line Color (customizable)
- MA Line Width (1-5, default 2)

**Visual Settings:**
- Show Buy/Hold/Sell Labels (toggle)
- Label Size (Tiny/Small/Normal/Large/Huge)
- Label Distance from Bars (0.1-2.0x, prevents overlap)
- Show Manipulation Warnings (toggle)
- Show Watermark (toggle)

**Dashboard:**
- Position (4 corners)
- Size (Small/Normal/Large)
- Background Color (fully customizable)
- Border Color (fully customizable)

**Alerts:**
- Toggle institutional activity alerts
- Three types: Strong Buy, Strong Sell, Manipulation Detection

═══════════════════════════════════════════════════════════════════════════════
RECOMMENDED SETTINGS BY TRADING STYLE
═══════════════════════════════════════════════════════════════════════════════

**Day Trading (15min-1H):**
- Volume Threshold: 1.3x
- Large Order Multiplier: 2.5x
- Flow Period: 7-10
- Label Distance: 0.3-0.4x

**Swing Trading (4H-Daily) - DEFAULT:**
- Volume Threshold: 1.5x
- Large Order Multiplier: 3.0x
- Flow Period: 14
- Label Distance: 0.5x

**Position Trading (Daily-Weekly):**
- Volume Threshold: 2.0x
- Large Order Multiplier: 5.0x
- Flow Period: 21
- Label Distance: 0.7-1.0x

═══════════════════════════════════════════════════════════════════════════════
BEST MARKETS & TIMEFRAMES
═══════════════════════════════════════════════════════════════════════════════

**Optimal Performance:**
- Timeframes: 1-hour, 4-hour, Daily
- Markets: Liquid stocks and ETFs (avg volume >1M shares/day)
- Market Cap: >$500M (ensures institutional participation)
- Examples: SPY, QQQ, AAPL, MSFT, NVDA, TSLA, major sector ETFs

**Less Effective:**
- Penny stocks (<$500M market cap)
- Low-volume securities
- Cryptocurrency (different volume dynamics)
- Timeframes below 15 minutes (excessive noise)

═══════════════════════════════════════════════════════════════════════════════
EDUCATIONAL FEATURES
═══════════════════════════════════════════════════════════════════════════════

**Interactive Learning:**

Every signal includes a hover tooltip that explains:
- **Why** - The specific conditions that triggered the signal
- **What** - The exact metric values (momentum, MFI, volume)
- **How** - Specific trading actions to take
- **When** - Exit conditions to monitor
- **Risk** - Management recommendations

**Example Tooltips:**

**BUY Signal:** "Institutions actively accumulating. Momentum: X.XX | MFI: XX | Volume: X.Xx avg. Large orders detected. Consider LONG positions or CALL options. Place stops below support."

**HOLD Signal:** "Consolidation phase. No clear direction. HOLD profitable positions. DO NOT enter new trades. Many traders exit too early during consolidation - institutions accumulate before next move."

**Manipulation Warning:** "High volume with minimal price movement. Possible spoofing, layering, or wash trading. STAY OUT. Tighten stops. Expect whipsaw. Wait for warning to clear."

═══════════════════════════════════════════════════════════════════════════════
LIMITATIONS & DISCLOSURES
═══════════════════════════════════════════════════════════════════════════════

**What This Indicator DOES:**
✓ Analyzes publicly available price and volume data
✓ Identifies patterns consistent with institutional activity
✓ Detects suspicious volume/price relationships
✓ Provides statistical money flow analysis
✓ Helps traders hold through normal volatility

**What This Indicator DOES NOT DO:**
✗ Access external APIs or institutional order flow data
✗ Track actual institutional orders (infers from patterns)
✗ Guarantee profitable trades
✗ Replace risk management
✗ Work reliably on illiquid securities
✗ Provide financial advice

**Technical Limitations:**
- Uses confirmed bar data only (no repainting)
- Requires minimum 50 bars for volume baseline
- Daily Flow resets at market open
- Manipulation detection can have false positives during low liquidity
- Label positioning may overlap on extreme values

**Trading Disclaimers:**
- Infers institutional activity through statistical analysis
- Should complement, not replace, fundamental analysis
- Past performance does not guarantee future results
- Always use proper position sizing and stop losses
- Not a registered investment advisor

**Risk Warning:**
Options trading carries substantial risk. This indicator is provided for educational purposes. Users should conduct due diligence and consult licensed professionals before trading.

═══════════════════════════════════════════════════════════════════════════════
ALERT CONDITIONS
═══════════════════════════════════════════════════════════════════════════════

Three built-in alert types:

1. **Strong Buy Signal** - Bright green bars appear (>0.3 momentum + bullish regime + unusual volume)
2. **Strong Sell Signal** - Bright red bars appear (<-0.3 momentum + bearish regime + unusual volume)
3. **Manipulation Detected** - Suspicious volume/price patterns occur

To enable:
- Click three dots next to indicator name
- Select "Create Alert"
- Choose alert condition
- Configure notifications
- Set frequency to "Once Per Bar Close"

═══════════════════════════════════════════════════════════════════════════════
TECHNICAL SPECIFICATIONS
═══════════════════════════════════════════════════════════════════════════════

- **Pine Script Version:** v6
- **Type:** Oscillator (separate pane)
- **Repainting:** None - uses confirmed bar data only
- **Lookahead Bias:** None
- **Max Bars Back:** 500
- **Computational Load:** Low to moderate
- **Bar Replay Compatible:** Yes

═══════════════════════════════════════════════════════════════════════════════
VERSION HISTORY
═══════════════════════════════════════════════════════════════════════════════

**v1.0** (Initial Release)
- Histogram-based institutional momentum display
- 5 customizable plot styles
- 12-metric comprehensive dashboard
- Flow magnitude tracking (M/B/T units)
- 21-period moving average overlay
- Manipulation detection algorithm
- Educational tooltip system on all signals
- BUY/HOLD/SELL label system with positioning
- Market regime classification
- Three alert conditions
- Fully customizable dashboard (size, colors, position)

═══════════════════════════════════════════════════════════════════════════════
CREDITS
═══════════════════════════════════════════════════════════════════════════════

Developed from scratch using Pine Script v6 and standard TradingView built-in functions. No code copied from other scripts. Methodology combines classical volume analysis with modern institutional flow detection.

═══════════════════════════════════════════════════════════════════════════════

This indicator helps swing traders answer: "Should I hold or exit?" By analyzing institutional activity and warning of manipulation, it provides the framework to stay in winning trades while protecting against adverse conditions.

Published open-source to contribute to the TradingView community.

Questions or feedback? Leave a comment below.

═══════════════════════════════════════════════════════════════════════════════

Disclaimer: Provided "as-is" without warranty. Use at your own risk. Past performance does not guarantee future results.

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。