Entry Assistant

NOTE: if anyone wants something specific added or a separate code relative to this, please ask. We will get it done.
### Purpose / What it's used for
This script helps traders spot high-conviction setups by requiring **all three** layers of confirmation:
- Significant volume anomalies (multiple different volume spike conditions firing at once)
- Clear directional agreement across several price trend checks (close, body, high/low structure)
- **Consistent higher-timeframe market structure** (higher highs + higher lows for bulls, lower highs + lower lows for bears)
The final output is an **entry strength score** (from -3 to +3) that shows how strong the bullish or bearish case is on the current bar.
Most common uses:
- Filter high-probability entries in discretionary trading
- Build the foundation for automated/quantitative strategies
- Visual regime detection (**Strong Trend** / **Congestion** / **Ranging / Choppy**)
- Spot climactic volume + trend exhaustion, breakout, or structure failure situations
### Core Idea in simple terms
"A bar is interesting when:
- A lot of unusual volume things are happening at the same time, **AND**
- Price structure is clearly trending in one direction across different measures, **AND**
- The broader market structure (pivots) is confirming the direction with higher highs/lows (or lower highs/lows) and building streak counts"
The more conditions that align → the higher the score → the more confident the signal.
### Main Components of the Code
| Part | What it does | Why it's useful |
|-----------------------------------|--------------------------------------------------------------------------------------------------|------------------------------------------------------|
| Volume Spike Detection | 5 different ways to detect abnormal volume (%, MA spike, ATR-adjusted, stdev, z-score) | Catches different styles of volume climaxes |
| Volume Pressure / Trend | Buying vs Selling pressure using (C-L) vs (H-C) weighted by volume | Tells you who was more aggressive |
| Slope-based Trend Detection | Custom average normalized slope over last 5 & 8 bars (close, body, H+L) | Realistic trend detection (better than strict monotonic) |
| Trend Agreement Counter | Counts how many of the 6 trend signals (3 structures × 2 lengths) agree | Requires broad confirmation, reduces whipsaws |
| Pivot / Market Structure System | Zigzag-like pivot detection → Higher Highs/Lower Highs, Higher Lows/Lower Lows + streak counts | Adds "outside" structure context (trend vs chop) |
| Entry Strength Logic | Combines volume count + trend agreement → gives score -3..3 | Quantifies conviction of the move |
| Enhanced Market Regime | Trend (with structure confirmation) / Congestion (low vol) / Ranging (mixed pivots/chop) | Helps avoid trading in low-conviction or choppy zones |
### Key Additions from Pivot System
- Detects swing highs/lows using high/low trend state as base (same as ToS highlowTrState2)
- Classifies pivots into:
- Higher Highs (HH) / Lower Highs (LH)
- Lower Lows (LL) / Higher Lows (HL)
- Tracks **consecutive streak counts** (hhcnt, lhcnt, llcnt, hlcnt) for trend strength
- Strengthens **regime classification**:
- Strong **Trend** → entry strength + aligned pivots (HH+HL for bull, LH+LL for bear)
- **Congestion** → low volume + low volatility
- **Ranging/Choppy** → mixed pivot signals (e.g. HH+LL or LH+HL) or frequent resets
### Current Status (January 2026)
Actively used & evolving version of my personal trading toolkit.
The pivot/market structure layer has significantly improved regime filtering and reduced entries in choppy conditions.
Not meant to be a holy-grail indicator — rather a **high-quality, multi-layer filter** for setups that already look good on higher timeframes.
Feedback, ideas & pull requests are very welcome!
(Especially around performance — the slope loop and pivot recursion are still brute-force and could be vectorized)
Happy trading!
— Adventures of a Single Dad

