OPEN-SOURCE SCRIPT
STRAT 3-2-2 (30m) • Upcoming / Approach / Entry + Alerts

This indicator is built for The STRAT trading method, specifically the 3-2-2 reversal pattern. It monitors price action on the 30-minute timeframe (HTF = 30m) and visually/alert-wise highlights where a 3-2-2 setup, approach, or entry trigger occurs.
---
⚙️ How it works
1. Detects bar types:
3 (Outside Bar) = range breaks both high & low of the previous bar
2u (Up bar) = higher high, not outside
2d (Down bar) = lower low, not outside
1 (Inside bar) = fully contained within prior bar
2. Looks for 3-2-2 setups:
Bullish 3-2-2 = 3 → 2d → 2u (expect reversal UP)
Bearish 3-2-2 = 3 → 2u → 2d (expect reversal DOWN)
3. Defines trigger levels:
Bullish trigger = high of the first “2d” bar
Bearish trigger = low of the first “2u” bar
4. Signals 3 phases:
Upcoming: pattern is forming, second “2” hasn’t triggered yet
Approach: price comes within 50% (adjustable) of the trigger level
Entry: price breaks the trigger (actual reversal confirmation)
5. Visualization:
Labels above/below candles show “Approach” and “Entry”
Background or bar colors (toggle in settings) highlight Setup / Approach / Entry
Optional dotted line marks the trigger level for clarity
---
🔔 Alerts
Two alert systems are built in:
1. Safe static conditions (for normal TradingView alert setup):
APPROACH: Bullish 3-2-2 (30m)
APPROACH: Bearish 3-2-2 (30m)
ENTRY: Bullish 3-2-2 (30m)
ENTRY: Bearish 3-2-2 (30m)
2. Dynamic messages (using alert() calls with price info):
If you create an alert with “Any alert() function call”, the pop-up will include the trigger price.
---
📋 Inputs (Settings)
Signal timeframe (HTF) → default 30m
Confirm signals at HTF bar close → waits for bar close (non-repainting)
Approach = % of first '2' bar range → default 50%
Show labels → On/Off
Color candles instead of background → toggle between candle color vs. chart background
---
⚙️ How it works
1. Detects bar types:
3 (Outside Bar) = range breaks both high & low of the previous bar
2u (Up bar) = higher high, not outside
2d (Down bar) = lower low, not outside
1 (Inside bar) = fully contained within prior bar
2. Looks for 3-2-2 setups:
Bullish 3-2-2 = 3 → 2d → 2u (expect reversal UP)
Bearish 3-2-2 = 3 → 2u → 2d (expect reversal DOWN)
3. Defines trigger levels:
Bullish trigger = high of the first “2d” bar
Bearish trigger = low of the first “2u” bar
4. Signals 3 phases:
Upcoming: pattern is forming, second “2” hasn’t triggered yet
Approach: price comes within 50% (adjustable) of the trigger level
Entry: price breaks the trigger (actual reversal confirmation)
5. Visualization:
Labels above/below candles show “Approach” and “Entry”
Background or bar colors (toggle in settings) highlight Setup / Approach / Entry
Optional dotted line marks the trigger level for clarity
---
🔔 Alerts
Two alert systems are built in:
1. Safe static conditions (for normal TradingView alert setup):
APPROACH: Bullish 3-2-2 (30m)
APPROACH: Bearish 3-2-2 (30m)
ENTRY: Bullish 3-2-2 (30m)
ENTRY: Bearish 3-2-2 (30m)
2. Dynamic messages (using alert() calls with price info):
If you create an alert with “Any alert() function call”, the pop-up will include the trigger price.
---
📋 Inputs (Settings)
Signal timeframe (HTF) → default 30m
Confirm signals at HTF bar close → waits for bar close (non-repainting)
Approach = % of first '2' bar range → default 50%
Show labels → On/Off
Color candles instead of background → toggle between candle color vs. chart background
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.