ABC Pattern - Buy & Sell Zones IT'S OPEN SOURCE FOR YOU
📊 ABC Pattern — Mathematical Price Target Formula
What is the ABC Pattern?
The ABC pattern is a price structure that identifies high-probability buy and sell zones using three pivot points: A, B, and C. Instead of relying on subjective analysis, this indicator uses a simple mathematical formula to calculate an exact price target — removing guesswork from your trading.
🧠 The Logic Behind It
Price never moves in a straight line. It swings up and down, creating a series of highs and lows. The ABC pattern captures one complete swing cycle and uses the relationship between those three points to project where price is likely to go next.
📐 The Formula
Target = (B × C) ÷ A
That's it. Three prices. One calculation. One target.
📈 Bullish ABC — Buy Zone Setup
Structure:
A (Low) → B (High) → C (Higher Low)
Rules:
A is the starting low
B is the peak above A
C is a pullback that holds above A (higher low = bullish structure)
The formula projects where price should reach after C
Example:
A = 100 (first low)
B = 150 (peak)
C = 120 (higher low pullback)
Target = (150 × 120) ÷ 100 = 180
Why does this work?
When C holds above A, it tells us buyers are stepping in at higher prices. The market structure is healthy. The formula uses the proportional relationship between the three pivots to project a mathematically derived target — not a random level.
Invalidation:
❌ A candle closes below C → pattern is cancelled. The higher low structure is broken, meaning sellers have taken control.
📉 Bearish ABC — Sell Zone Setup
Structure:
A (High) → B (Low) → C (Lower High)
Rules:
A is the starting high
B is the trough below A
C is a bounce that fails below A (lower high = bearish structure)
The formula projects the downside target from C
Example:
A = 200 (first high)
B = 150 (trough)
C = 180 (lower high bounce)
Target = (150 × 180) ÷ 200 = 135
Why does this work?
When C fails to reach A, it tells us sellers are entering at lower prices. The market is making lower highs — a classic bearish sign. The formula captures this momentum and projects the next logical price level.
Invalidation:
❌ A candle closes above C → pattern is cancelled. The lower high structure is broken, meaning buyers have reclaimed control.
⚙️ How the Indicator Works
Pivot Detection
The script automatically detects swing highs and lows using a configurable lookback period. A larger lookback finds bigger, more significant patterns. A smaller lookback finds more frequent, shorter-term setups.
Pattern Validation
Before drawing anything, the script checks three conditions:
Time sequence is correct (A → B → C in order)
Structure is valid (C is higher than A for bulls / lower for bears)
B is the extreme between A and C
What gets drawn on the chart:
A, B, C labels at each pivot with the price
Entry line at C level (where you look to trade)
Target line calculated by the formula
Colored zone between C and Target (your reward area)
Failure level — the line that invalidates the setup
% labels showing the move size of each leg
📋 Trading Guidelines
BullishBearishEntryNear C (higher low)Near C (lower high)Target(B × C) ÷ A(B × C) ÷ AInvalidationClose below CClose above CBiasUptrend structureDowntrend structure
⚠️ Important Notes
This is not a signal indicator. It identifies a mathematical structure. Always combine with your own analysis, volume, and market context.
Works on all timeframes and all assets (stocks, crypto, forex, commodities).
Adjust the Pivot Lookback setting based on your timeframe:
Scalping (1m–5m): Lookback 5–8
Intraday (15m–1H): Lookback 10–15
Swing (4H–Daily): Lookback 15–25
🔔 Alerts Included
✅ Bullish ABC pattern detected
✅ Bearish ABC pattern detected
⚠️ Bullish pattern failed (close below C)
⚠️ Bearish pattern failed (close above C)
The formula is simple. The discipline to follow it is what separates consistent traders from the rest.
Pine Script® indicator






















