OPEN-SOURCE SCRIPT
Updated

Egg vs Tennis Ball — Drop/Rebound Strength

578
Egg vs Tennis Ball — Drop/Rebound Meter

What it does
Classifies selloffs as either:
  • []Eggs — dead‑cat, no bounce
    []Tennis Balls — fast, decisive rebound


Core features
  • []Detects swing drops from a Pivot High (PH) to a Pivot Low (PL)
    []Requires drops to be meaningful (volatility‑aware, ATR‑scaled)
    []Draws a bounce threshold line and a deadline
    []Decides outcome based on speed and extent of rebound
    []Tracks scores and win rates across multiple lookback windows
    []Includes a color‑coded meter and current streak display


Visuals at a glance
  • []Gray diagonal — drop from PH to PL
    []Teal dotted horizontal — bounce threshold, from PH to the deadline
    []Solid green — Tennis Ball (bounce line broken before the deadline)
    []Solid red — Egg (deadline expired before the bounce)
  • Optional PH / PL labels for clarity


How the decision is made
  • []1) Find pivots — symmetric pivots using Pivot Left / Right; PL confirms after Right bars.
    []2) Qualify the drop — Drop Size = PH − PL; must be ≥ (Drop Threshold × ATR at PL).
    []3) Define the bounce line — PL + (Bounce Multiple × Drop Size). 1.00× = full retrace to PH; up to 2.00× for overshoot.
    []4) Set the deadline — Drop Bars = PL index − PH index; Deadline = Drop Bars × Recovery Factor; timer starts from PH or PL.
  • 5) Resolve — Tennis Ball if price hits the bounce line before the deadline; Egg if the deadline passes first.


Scoring system (−100 to +100)
  • []+100 = perfect Tennis Ball (fastest possible + full overshoot)
    []−100 = perfect Egg (no recovery)
  • In between: scored by rebound speed and extent, shaped by your weight settings


Meter Table
Columns (toggle on/off)
  • []All (off by default)
    []Last N1 (default 5)
    []Last N2 (default 10)
    []Last N3 (default 20)


Rows
  • []Tennis / Eggs — counts
    []% Tennis — win rate
    []Avg Score — normalized quality from −100 to +100
    []Streak — overall (not windowed), e.g., +3 = 3 Tennis Balls in a row, −4 = 4 Eggs in a row


Alerts
  • []Tennis Ball – Fast Rebound — triggers when the bounce line is broken in time
    []Egg – Window Expired — triggers when the deadline passes without a bounce


Inputs

① Drop Detection
  • []Pivot Left / Right
    []ATR Length
  • Drop Threshold × ATR


② Bounce Requirement
  • Bounce Multiple × Drop Size (0.10–2.00×)


③ Timing
  • []Timer Start — PH or PL
    []Recovery Factor × Drop Bars
  • Break Trigger — Close or High


④ Display
  • []Show Pivot/Outcome Labels
    []Line Width
  • Table Position (corner)


⑤ Meter Columns
  • []Show All (off by default)
    []Show N1 / N2 / N3 (5, 10, 20 by default)


⑥ Scoring Weights
  • []Tennis — Base, Speed, Extent
    []Egg — Base, Strength


How to use it
  • []Pick strictness — start with Drop Threshold = 2.0 ATR, Bounce Multiple = 1.0×, Recovery Factor = 3.0×; adjust to timeframe and volatility.
    []Watch the dotted line — it ends at the deadline; turns solid green (Tennis) if broken in time, solid red (Egg) if it expires.
    []Read the meter — short windows (5–10) show current behavior; Avg Score captures quality; Streak shows momentum.
    []Blend with your system — combine with trend filters, volume, or regime detection.


Tips
  • []Close vs High trigger: Close is stricter; High is more responsive.
    []PH vs PL timer start: PH measures round‑trip; PL measures recovery only.
    []Increase pivot strength for fewer, more reliable signals.
    []Higher timeframes generally produce cleaner patterns.


Defaults
  • []Pivot L/R: 5 / 5
    []ATR Length: 14
    []Drop Threshold: 2.0× ATR
    []Bounce Multiple: 1.00×
    []Recovery Factor: 3.0×
    []Break Trigger: Close
  • Windows: Last 5, 10, 20 (All off)


Interpreting results
  • []Tennis‑y: Avg Score +30 to +70, %Tennis > 55%
    []Mixed: Avg Score near 0
  • Egg‑y: Avg Score −30 to −80, %Tennis < 45%
Release Notes
Updated table to default to a "Simple" version and added a composite score

Disclaimer

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.