Pivot Channel Map [AGPro Series]

A sophisticated pivot-based channel mapping engine that auto-detects structural channels from swing pivots, qualifies them with ATR-normalized filters, and visualizes the active market structure.

Overview

This indicator automatically identifies 8 distinct channel types from price pivots:

Channel TypeClassDescription
Major External UpMajorStructural Higher Highs in bullish trend
Major External DownMajorStructural Lower Lows in bearish trend
Major Internal UpMajorHigher Lows inside broader bullish structure
Major Internal DownMajorLower Highs inside broader bearish structure
Minor External UpMinorLocal Lower Lows in short-term bullish moves
Minor External DownMinorLocal Higher Highs in short-term bearish moves
Minor Internal UpMinorHigher Lows in micro bullish structure
Minor Internal DownMinorLower Highs in micro bearish structure

Core Concepts

1. Pivot Detection Engine

agp_PivotPeriod = input.int(5, 'Pivot Period', minval = 2, maxval = 50)
 
// Pivot high/low detection
agp_HighPivot = ta.pivothigh(pivotPeriod, pivotPeriod)
agp_LowPivot  = ta.pivotlow(pivotPeriod, pivotPeriod)
  • Pivot Period: Number of bars on each side to confirm a pivot
  • Higher values = fewer, more structural pivots
  • Lower values = more, noise-sensitive pivots

2. Channel Classification

The indicator classifies each pivot point into categories:

SymbolMeaning
HHHigher High (bullish)
HLHigher Low (bullish continuation)
LHLower High (bearish)
LLLower Low (bearish)
HGeneric High
LGeneric Low

3. Major vs Minor Structure

Major Structure:  Larger timeframe swings, institutional levels
Minor Structure:   Smaller timeframe swings, retail trading zones

Major channels use:
- Wider ATR width requirements
- Longer span minimums
- Stronger visual emphasis

Key Features

Channel Qualification Engine

Filters structurally weak channels before drawing:

// Modes
'Off'      // Show all valid channels (default)
'Balanced' // Filter noise, keep healthy structures
'Strict'   // Only wide, persistent structures
 
// ATR-based filtering
agp_QualMode   = 'Balanced'
agp_QualAtrLen = 14

Qualification Parameters:

ModeMajor Min SpanMinor Min SpanMin Width (ATR)
Off000
Balanced8 bars5 bars0.20
Strict16 bars10 bars0.60

Broken Channel Memory

Preserves invalidated channels as faded historical context:

agp_BrokenMemoryScope = 'Major Only'  // 'Off', 'All'
agp_BrokenMemoryKeep  = 'Last 1'        // 'Last 2'
agp_BrokenMemoryStyle = line.style_dashed

Interaction Zones

Right-edge pockets showing where price interacts with channel rails:

agp_ShowInteractionZones  = true
agp_InteractionWidthAtr  = 0.18      // Zone width
agp_InteractionExtendBars = 25       // Forward projection

Post-Break Retest/Reclaim Signals

Tracks valid retests or reclaims after channel breaks:

agp_ShowPostBreakSignals = true
agp_PostBreakWindow      = 20        // Bars to watch after break
agp_PostBreakOffsetAtr   = 0.38      // Label vertical offset

Signal Types:

  • RECLAIM: Price returned above/below broken level
  • RETEST: Price touched but didn’t reclaim broken level

Visual Settings

Line Emphasis Modes

Controls visual contrast between active channels:

agp_EmphasisMode = 'Balanced'  // 'Off', 'Balanced', 'Strong'
 
// Balanced: Major base lines slightly more prominent
// Strong:   Clear separation between channel rails

Event Markers

Compact markers on confirmed break/react events:

agp_ShowEventMarkers    = true
agp_ReactCooldownBars   = 20       // Min bars between React markers
agp_ReactMinPriceAtr    = 0.75     // Min ATR distance for new React

Channel Quick Tags

Compact labels showing channel family:

TagMeaning
MEX UPMajor External Up
MEX DNMajor External Down
MIN UPMajor Internal Up
MIN DNMajor Internal Down
mEX UPMinor External Up
mIN DNMinor Internal Down

Info Panel

Real-time dashboard showing:

AG Pro Pivot Channel Map
─────────────────────────────────
Major Live      : 1 Up | 0 Down
Minor Live      : 2 Up | 1 Down
Nearest Channel : M.Ext Up | 0.45 ATR | Near
Qualification   : Balanced | All
Interaction      : Major Only | Both
Post-Break       : Major Only | 20 bars | Bullish Major Tilt

Alert System

Alert Types

AlertTriggerDefault
Break AlertChannel origin brokenOn (Major) / Off (Minor)
React AlertPrice touched origin after breakOn (Major) / Off (Minor)

Alert Configuration

agp_AlertName      = 'Pivot Channel Map [AGPro] Alerts'
agp_AlertFrequency = 'Once Per Bar'   // 'All', 'Once Per Bar', 'Per Bar Close'
agp_AlertTimezone  = 'UTC'

Usage Tips

Best Timeframes

TimeframeRecommended Settings
Daily/WeeklyPivot Period 5-10, Balanced qualification
4HPivot Period 5-8, Balanced/Strict
1HPivot Period 5, Balanced
15mPivot Period 3-5, Strict recommended

Chart Clarity Settings

If chart feels too busy:

  1. Enable Strict qualification mode
  2. Set Midline Scope to Major Only
  3. Reduce Pivot Period for fewer pivots
  4. Use React Cooldown to reduce overlapping markers

Trading Applications

Trend Identification:

  • Parallel Major channels indicate strong trends
  • Channel width increasing = trend acceleration
  • Multiple Minor channels inside Major = trend consolidation

Breakout Trading:

  • Break of Major External channel = potential trend reversal
  • Break of Minor channel = potential pullback entry

Range Trading:

  • Multiple intersecting channels = range-bound market
  • Price bouncing between channels = mean reversion setup

Pine Script Architecture

State Containers

// Channel state arrays (8 slots for 8 channel types)
var agp_ActiveOriginNow   = array.new_float(8, na)
var agp_ActiveChannelNow  = array.new_float(8, na)
var agp_ActiveIsLive      = array.new_bool(8, false)
var agp_ChannelTypeStore  = array.new_string(8, '')
var agp_ChannelClassStore = array.new_string(8, '')
 
// Break tracking
var agp_BreakLevelStore   = array.new_float(8, na)
var agp_BreakBarStore     = array.new_int(8, na)
var agp_BreakModeStore    = array.new_string(8, '')

Main Execution Flow

1. Calculate pivots (agp_calculatePivots)
   ↓
2. Find channel points (agp_findChannelPoints)
   ↓
3. Draw and alert (agp_drawAndAlert) for each channel type
   ↓
4. Render interaction zones
   ↓
5. Update post-break signals
   ↓
6. Render info panel
   ↓
7. Fire alerts

Color Palette

ColorHexUsage
Bull Green#22C5A6Bullish channels
Bear Pink#F472B6Bearish channels
Neutral#F5BD5CNeutral/warning
Accent#818CF8UI highlights
Header BG#2563EBPanel header


Part of the AGPro Series - Professional Trading Tools