Trading Methodology Documentation

Comprehensive guide to all analysis systems, indicators, and scoring methodologies

📊 Portfolio Scoring System

The Portfolio Scoring System combines multiple data sources into weighted composite scores, providing directional bias and position sizing recommendations for each ticker.

📈 Component Scores

Component Source Raw Range Description
score_lr Linear Regression -15 to +15 Multi-timeframe trend alignment
score_ti Technical Indicators -10 to +10 40+ indicator composite
score_options Options Data -10 to +10 P/C ratios, IV rank, skew
score_rrg RRG -8 to +8 Quadrant alignment vs SPY
score_sa_quant Seeking Alpha 1 to 5 SA Quant rating
score_sctr StockCharts 0 to 100 SCTR ranking
score_pac PAC Scan 0 to 10 Price Action Context grade

⚖️ Weighting Schemes

Scheme LR TI Options RRG SA SCTR PAC Focus
Balanced 20% 20% 20% 10% 10% 10% 10% Equal emphasis
Momentum 25% 25% 20% 15% 5% 5% 5% Trend/technical
Conservative 15% 15% 15% 15% 20% 10% 10% Fundamentals

🏷️ Bias Labels

Label Score Range Interpretation
STRONG_LONG >= 6 High conviction long
LONG >= 3 Moderate long bias
NEUTRAL -3 to 3 No clear edge
SHORT <= -3 Moderate short bias
STRONG_SHORT <= -6 High conviction short

🔴 Red Team Indicator (Contrarian Analysis)

"The Red Team exists to find reasons why this trade will fail, even when everything looks bullish."
The Red Team provides a devil's advocate perspective, identifying reasons NOT to enter a trade. It challenges both long and short positions with 9 components weighted to detect reversal risk.

🧩 Components (9 Total)

Divergences 20%

What it catches: 3+ divergences aligned against trade direction

Indicators checked:

  • RSI Divergence
  • MACD Divergence
  • OBV Divergence
  • MFI Divergence
  • Stochastic Divergence
CountScore
4+ divergences-10
3 divergences-7
2 divergences-4
1 divergence-1
Warning Flag: DIVERGENCE_CLUSTER - Triggered when 3+ divergences detected
Oscillator Extremes 12%

What it catches: Multiple oscillators in overbought/oversold zones = mean reversion imminent

For LONG positions (overbought check):

  • RSI > 75
  • Stochastic K > 80
  • MFI > 80
  • CCI > 150
  • Williams %R > -10

For SHORT positions (oversold check):

  • RSI < 25
  • Stochastic K < 20
  • MFI < 20
  • CCI < -150
  • Williams %R < -90
Score = -2 per extreme reading (max -10)
Warning Flag: EXTREME_READINGS - Triggered when 3+ oscillators in extreme zone
Volume Confirmation 12%

What it catches: Price movement without volume support = weak conviction

Indicators checked:

  • OBV Slope (direction mismatch = -2)
  • CMF (Chaikin Money Flow, sign mismatch = -2)
  • Volume Ratio < 0.8 = -1
  • MFI divergence from price = -1
Warning Flag: NO_VOLUME_CONFIRM - Triggered when 4+ volume failures
Trend Strength 12%

What it catches: Strong directional score in a trendless market = false signal

ConditionPenalty
ADX < 15-4
ADX < 20-2
LR Confidence = VERY_LOW-3
LR Confidence = LOW-1
LR Pattern = CHOP-4
LR R² < 0.3-2
Warning Flag: TRENDLESS_MARKET - Triggered when CHOP pattern or ADX < 15
Timeframe Misalignment 12%

What it catches: Short-term and long-term disagreement = higher reversal probability

For LONG positions:

  • LR Divergence > 0.5 (overextension) = -3
  • EXHAUSTION_TOP pattern = -5
  • BOUNCE_DOWNTREND pattern = -4
  • Long-term (100d/200d) bearish = -3

For SHORT positions:

  • LR Divergence < -0.5 (oversold) = -3
  • EXHAUSTION_BOTTOM pattern = -5
  • PULLBACK_UPTREND pattern = -4
  • Long-term (100d/200d) bullish = -3
Warning Flag: EXHAUSTION_PATTERN - Triggered on exhaustion top/bottom patterns
Market Breadth 8%

What it catches: Individual stock vs market breadth divergence

For LONG positions:

  • STRONG_BEARISH regime = -8
  • BEARISH regime = -5
  • REDUCE_DIVERGENCE signal = -3
  • % above 200 SMA < 40% = -2

For SHORT positions:

  • STRONG_BULLISH regime = -8
  • BULLISH regime = -5
  • BUY_THRUST signal = -6
  • % above 200 SMA > 80% = -2
Warning Flag: BREADTH_CONFLICT - Triggered when penalty <= -5
Structure 4%

What it catches: Price at structural resistance/support = reversal zone

For LONG positions:

  • 52-week % > 95% (near highs) = -3
  • BB %B > 1.0 (above upper band) = -2

For SHORT positions:

  • 52-week % < 5% (near lows) = -3
  • BB %B < 0 (below lower band) = -2
Warning Flag: STRUCTURAL_WEAKNESS - Triggered when penalty <= -4
RRG Quadrant 10%

What it catches: RRG quadrant position conflicts with trade direction

For LONG positions:

  • Stock in LAGGING or WEAKENING = -4
  • Sector in LAGGING or WEAKENING = -3
  • Both stock AND sector in LAGGING = -2 (additional)

For SHORT positions:

  • Stock in LEADING or IMPROVING = -4
  • Sector in LEADING or IMPROVING = -3
  • Both stock AND sector in LEADING = -2 (additional)
Warning Flag: RRG_CONFLICT - Triggered when penalty <= -5
Options Market 10%

What it catches: Options market signals potential reversal

For LONG positions (reversal signals):

  • IV Rank > 80% = -3 (volatility spike = potential top)
  • IV Rank > 70% = -1
  • P/C Volume Ratio < 0.5 = -2 (extreme bullishness)
  • P/C OI Ratio < 0.5 = -1
  • Put Skew > 0.15 = -2 (smart money hedging)
  • IV Percentile > 85% = -2

For SHORT positions (reversal signals):

  • IV Rank < 20% = -3 (complacency = potential bottom)
  • IV Rank < 30% = -1
  • P/C Volume Ratio > 1.5 = -2 (extreme fear)
  • P/C OI Ratio > 1.5 = -1
  • Call Skew > 0.15 = -2
  • IV Percentile < 15% = -2
Warning Flag: OPTIONS_WARNING - Triggered when penalty <= -5

⚠️ Risk Levels & Position Sizing

Risk Level Score Range Action Position Size
CLEAR >= -2 Enter with confidence 100%
CAUTION -2 to -4 Enter with tighter stops 75%
HIGH_RISK -4 to -6 Wait for confirmation 50% or wait
DO_NOT_ENTER < -6 Skip trade entirely 0%

🟢 Green Team Indicator (Opportunity Discovery)

"The Green Team argues FOR opportunity in both directions - let the data decide which case is stronger."
The Green Team analyzes BOTH long AND short cases for every ticker, presenting the bullish and bearish thesis side by side. This allows for objective comparison of directional opportunities.

📈 LONG Case Components (8 Total)

Component Weight What It Detects
Bullish Momentum 18% Bullish divergences, RSI recovering from oversold, positive oscillator turns
Accumulation 18% OBV/CMF rising, volume dry-up on pullback, positive money flow
Oversold 12% RSI < 30, Stoch < 20, MFI < 20, at lower BB
Trend Support 12% PULLBACK_UPTREND pattern, long-term LR up, ADX strength
Timeframe 12% Short weak, long strong = catch-up opportunity
Sector Tailwind 8% Strong sector RRG, bullish breadth
Structure 5% Near 52-week lows, squeeze breakout potential
Options 15% Low IV (cheap entry), high P/C ratio (contrarian), put skew

Long Opportunity Flags

  • BULLISH_DIVERGENCE - 2+ bullish divergences detected
  • ACCUMULATION - OBV/CMF rising while price flat
  • OVERSOLD_EXTREME - 3+ oscillators oversold
  • PULLBACK_UPTREND - Weakness in established uptrend
  • SECTOR_TAILWIND - Strong sector support
  • OPTIONS_BULLISH - Options market bullish setup

📉 SHORT Case Components (8 Total)

Component Weight What It Detects
Bearish Momentum 18% Bearish divergences, RSI falling from overbought, negative turns
Distribution 18% OBV/CMF falling, low volume on rally, negative money flow
Overbought 12% RSI > 70, Stoch > 80, MFI > 80, at upper BB
Trend Against 12% RALLY_DOWNTREND pattern, long-term LR down
Timeframe 12% Short strong, long weak = fade opportunity
Sector Headwind 8% Weak sector RRG, bearish breadth
Resistance 5% Near 52-week highs, at resistance
Options 15% High IV (potential top), low P/C ratio (contrarian), call skew

Short Opportunity Flags

  • BEARISH_DIVERGENCE - 2+ bearish divergences detected
  • DISTRIBUTION - OBV/CMF falling while price flat
  • OVERBOUGHT_EXTREME - 3+ oscillators overbought
  • RALLY_DOWNTREND - Strength in established downtrend
  • SECTOR_HEADWIND - Weak sector pressure
  • OPTIONS_BEARISH - Options market bearish setup

💎 Opportunity Levels

Level Score Range Conviction
HIDDEN_GEM >= 8 100%
COMPELLING 6 to 8 80%
INTERESTING 4 to 6 60%
SPECULATIVE 2 to 4 30%
NO_OPPORTUNITY < 2 0%

🔄 Red Team + Green Team Integration

For complete analysis, combine all three perspectives: Green LONG case, Green SHORT case, and Red Team challenge.

📋 Decision Matrix

Green LONG Green SHORT Red Team Action
COMPELLING SPECULATIVE CLEAR Strong LONG - Full Position
COMPELLING SPECULATIVE CAUTION LONG - 75% Position
COMPELLING SPECULATIVE HIGH_RISK Small LONG - 50% Position
SPECULATIVE COMPELLING CLEAR Strong SHORT - Full Position
COMPELLING COMPELLING CAUTION Conflicting - Wait for clarity
Any Any DO_NOT_ENTER Skip trade entirely

Pre-Entry Checklist

  1. Run Green Team → Get LONG score + SHORT score
  2. Determine stronger case (higher score)
  3. Run Red Team on the stronger case direction
  4. Decision:
    • If Green >= COMPELLING and Red == CLEAR: Full position
    • If Green >= COMPELLING and Red == CAUTION: 75% position
    • If Green >= INTERESTING and Red <= HIGH_RISK: 50% position
    • If Red == DO_NOT_ENTER: Skip regardless of Green
  5. Position Size = Green conviction × Red position_mult

📉 Technical Indicators (40+ Indicators)

Comprehensive technical analysis across 8 indicator groups, each contributing to a weighted composite score.

📈 Trend Direction 20%

  • EMAs: 8, 20, 50, 200 period exponential moving averages
  • SMA 200: Long-term trend filter
  • VWAP: Volume-weighted average price
  • Supertrend: ATR-based trend indicator
  • Parabolic SAR: Stop and reverse points

💪 Trend Strength 12%

  • ADX: Average Directional Index (trend strength 0-100)
  • +DI / -DI: Directional indicators
  • Aroon: Up/Down oscillator
  • Linear Regression R²: Trend quality measure
ADX < 20 = weak trend, ADX 20-40 = moderate trend, ADX > 40 = strong trend

Momentum Oscillators 18%

Indicator Oversold Overbought
RSI (14) < 30 > 70
Stochastic K/D < 20 > 80
MACD Signal line crossovers
CCI (20) < -100 > 100
Williams %R < -80 > -20
ROC (Rate of Change) Momentum direction

🌊 Volatility 10%

  • Bollinger Bands: 20-period, 2 std dev
    • %B: Position within bands (0-1 normal, <0 or >1 = outside)
    • Bandwidth: Band width as % of middle band
  • Keltner Channels: ATR-based bands
  • ATR: Average True Range (volatility measure)
  • Squeeze: BB inside Keltner = volatility compression

📊 Volume Analysis 15%

  • OBV: On-Balance Volume (cumulative volume flow)
  • CMF: Chaikin Money Flow (-1 to +1)
  • MFI: Money Flow Index (volume-weighted RSI, 0-100)
  • A/D Line: Accumulation/Distribution
  • VWMA: Volume Weighted Moving Average
  • Volume Ratio: Current vs average volume

🏗️ Market Structure 10%

  • Pivot Points: S1, S2, R1, R2, PP (support/resistance)
  • Donchian Channels: 20-period high/low
  • Ichimoku Cloud: Tenkan, Kijun, Senkou A/B, Chikou
  • 52-Week Position: Current price as % of 52-week range

🔍 Pattern Recognition 7.5%

  • Golden Cross: 50 SMA crosses above 200 SMA
  • Death Cross: 50 SMA crosses below 200 SMA
  • MACD Crosses: Signal line crossovers
  • Squeeze Release: Breakout from BB/Keltner squeeze

↔️ Divergences & Warnings 7.5%

Divergence between price and indicator signals potential reversal:

Type Price Indicator Signal
Bullish Lower lows Higher lows +1
Bearish Higher highs Lower highs -1

Tracked on: RSI, MACD, OBV, MFI, Stochastic

📐 Linear Regression Confluence

Multi-timeframe trend alignment using linear regression across 5 periods: 200d, 100d, 50d, 20d, 5d.

📏 Methodology

  • Slope Normalization: Slopes normalized to standard deviations (volatility-adjusted)
  • R² Quality Filter: 0.50-0.65 minimum for valid signals
  • Direction: UP (+1), FLAT (0), or DOWN (-1) per period

🎯 Regime Classification

Regime Score Range Interpretation
STRONG_UPTREND +12 to +15 All timeframes aligned up
UPTREND +7 to +11 Majority aligned up
WEAK_UPTREND +3 to +6 Potential trend start
RANGING -2 to +2 Mixed signals
WEAK_DOWNTREND -6 to -3 Potential reversal
DOWNTREND -11 to -7 Majority aligned down
STRONG_DOWNTREND -15 to -12 All aligned down

🔄 Pattern Detection

Pattern Description Signal
BREAKOUT Shorter timeframes leading up while longer lag Bullish momentum building
PULLBACK_UPTREND Long-term up, short-term weakness Buy the dip opportunity
EXHAUSTION_TOP Shorter rolling over, longer still positive Potential top forming
CAPITULATION Oversold across frames, shortest stabilizing Potential bottom
CHOP R² < threshold on 3+ timeframes No trade zone

🔄 Relative Rotation Graph (RRG)

RRG measures relative strength and momentum versus a benchmark (SPY), plotting stocks in 4 quadrants that rotate clockwise as market cycles progress.

📍 Quadrants

Quadrant RS-Ratio RS-Momentum Interpretation
LEADING > 100 > 100 Outperforming and improving - strong hold/buy
WEAKENING > 100 < 100 Outperforming but losing momentum - watch/reduce
LAGGING < 100 < 100 Underperforming and weakening - avoid/short
IMPROVING < 100 > 100 Underperforming but gaining momentum - accumulate
Rotation: Stocks typically rotate clockwise: Improving → Leading → Weakening → Lagging → Improving

📊 Sector RRG

Sector analysis provides market context:

  • Stock in Leading + Sector in Leading = Strong tailwind
  • Stock in Leading + Sector in Lagging = Fighting the tide
  • Stock in Lagging + Sector in Leading = Potential catch-up
  • Stock in Lagging + Sector in Lagging = Avoid

📋 Options Analysis

Options market data provides sentiment and positioning insights that complement technical analysis.

📈 Implied Volatility Metrics

Metric Range Interpretation
IV Rank 0-100% Current IV vs 52-week range (high = expensive options)
IV Percentile 0-100% % of days IV was lower than current
ATM IV Varies At-the-money implied volatility
HV 30d Varies 30-day historical volatility
IV/HV Ratio > or < 1 Options premium relative to realized vol

⚖️ Put/Call Ratios

Metric Bullish Neutral Bearish
P/C Volume Ratio < 0.7 0.7 - 1.0 > 1.0
P/C OI Ratio < 0.7 0.7 - 1.0 > 1.0
Contrarian View: Extreme readings often signal reversals. Very high P/C = extreme fear = potential bottom. Very low P/C = complacency = potential top.

📍 Key Levels

  • Max Pain: Strike where options sellers profit most - price magnet at expiration
  • Put Support: High put OI strikes act as support
  • Call Resistance: High call OI strikes act as resistance
  • Expected Move: Straddle-implied range for the expiration period

📉 Skew Analysis

  • Put Skew: OTM puts more expensive = downside hedging demand
  • Call Skew: OTM calls more expensive = upside speculation
  • Term Structure: IV curve across expirations - backwardation vs contango

🌐 Market Breadth

Market breadth measures the participation of stocks in a market move, helping identify healthy trends vs divergences.

📊 Core Metrics

Metric Description
Advance/Decline Ratio Advancing stocks / Declining stocks
A/D Line Cumulative sum of (Advances - Declines)
% Above 20 SMA Short-term participation
% Above 50 SMA Medium-term participation
% Above 200 SMA Long-term participation
New Highs - New Lows 52-week extremes differential

📈 McClellan Indicators

  • McClellan Oscillator: 19/39 EMA of A-D difference
    • > 0: Bullish breadth
    • < 0: Bearish breadth
    • > +100 or < -100: Extreme readings
  • McClellan Summation: Cumulative oscillator (trend confirmation)

🚀 Breadth Thrust

10-day EMA of advances ratio. Rare but powerful signal:

BUY_THRUST Signal: Triggered when > 0.615 (61.5% advancing). Historically precedes strong rallies.

🏷️ Regime & Signals

Regime Description
STRONG_BULLISH Broad participation, healthy breadth
BULLISH Positive but not extreme
NEUTRAL Mixed signals
BEARISH Deteriorating breadth
STRONG_BEARISH Broad selling pressure

🎯 Price Action Context (PAC)

PAC analysis identifies the current stage of price action and provides context for trade timing.

📊 Stages

Based on Stan Weinstein's Stage Analysis methodology:

Stage Characteristics Action
Stage 1: Basing Consolidation after downtrend, flat 200 SMA Watch for breakout
Stage 2: Advancing Price above rising 200 SMA Buy, hold longs
Stage 3: Topping Consolidation at highs, flattening 200 SMA Take profits, tighten stops
Stage 4: Declining Price below falling 200 SMA Short or avoid

📈 Grade (0-10)

PAC Grade factors:

  • Price position relative to key EMAs
  • EMA stacking (8 > 20 > 50 > 200 for uptrend)
  • Volume confirmation
  • Recent breakout/breakdown
  • Trend strength (ADX)

📁 File Reference

File Purpose
scripts/_lib_red_team.py Red Team contrarian analysis library
scripts/_lib_green_team.py Green Team opportunity discovery library
scripts/37_calculate_red_team.py Red Team score calculator
scripts/38_calculate_green_team.py Green Team score calculator
scripts/33_calculate_indicators.py Technical indicators calculator
scripts/32_calculate_linreg.py Linear regression confluence
scripts/31_calculate_rrg.py RRG score calculator
scripts/35_calculate_options_metrics.py Options metrics calculator
scripts/36_calculate_market_breadth.py Market breadth calculator
scripts/42_combine_data.py Portfolio scoring integration