OPEN-SOURCE SCRIPT
Cập nhật Amd range by dan

Amd Range – Multi-Timeframe Volatility Breakout Scanner
Overview
Amd Range automatically detects price compression structures (Inside Bars) and alerts traders in real-time when price breaks out of the established range. The indicator monitors multiple timeframes simultaneously and can track up to 5 symbols from a single chart.
Core Methodology – What This Script Does
This indicator is based on the classic Inside Bar pattern — a volatility contraction setup where a candle's high and low are contained entirely within the previous candle's range.
Detection Logic:
Master Bar Identification: On each bar close, the script checks if the current candle qualifies as an Inside Bar:
Current High < Previous High
Current Low > Previous Low
When this condition is true, the previous candle becomes the "Master Bar", and its high/low levels define the active range.
Real-Time Breakout Detection: Once a range is established, the indicator monitors every tick (not just bar closes) for a breakout:
Bullish Breakout: Current price exceeds the Master Bar High → triggers BUY signal
Bearish Breakout: Current price drops below the Master Bar Low → triggers SELL signal
One-Shot Alert System: Each range produces exactly one alert. Once broken, the range is deactivated and no further alerts fire until a new Inside Bar forms and subsequently breaks.
Multi-Timeframe Scanning
The indicator uses request.security() to scan six higher timeframes simultaneously:
M30, H1, H2, H4, H8, H12
Each timeframe maintains independent state tracking, so a breakout on H4 does not affect H1 detection.
Dashboard Display
The built-in table displays real-time status for each symbol/timeframe combination:
RNG (Gray): Active range – volatility contraction in progress
BUY (Green): Bullish breakout detected
SELL (Red): Bearish breakout detected
- (Dark): No active pattern
How to Use
Add the indicator to any chart
Configure symbols in the "Extra Symbols" input group to monitor additional assets
Enable/disable timeframes in the "Timeframe Alerts" input group
Create a TradingView alert with the condition "Any alert() function call"
Trade the breakout — BUY signals indicate price has cleared resistance; SELL signals indicate price has broken support
Inputs
Show Range Lines: Toggle horizontal lines marking Master Bar high/low
Show BUY/SELL Labels: Toggle visual labels at breakout points
Show Dashboard Table: Toggle the multi-symbol status table
Range Line Color: Customize line color
Timeframe Toggles (M30–H12): Enable/disable alerts per timeframe
Symbol 1–4: Additional symbols to monitor
Important Notes
Alerts fire immediately on breakout (no waiting for candle close)
Only one alert per range – no repeat signals
Designed for forex, crypto, and futures markets
Works on all standard chart types
Overview
Amd Range automatically detects price compression structures (Inside Bars) and alerts traders in real-time when price breaks out of the established range. The indicator monitors multiple timeframes simultaneously and can track up to 5 symbols from a single chart.
Core Methodology – What This Script Does
This indicator is based on the classic Inside Bar pattern — a volatility contraction setup where a candle's high and low are contained entirely within the previous candle's range.
Detection Logic:
Master Bar Identification: On each bar close, the script checks if the current candle qualifies as an Inside Bar:
Current High < Previous High
Current Low > Previous Low
When this condition is true, the previous candle becomes the "Master Bar", and its high/low levels define the active range.
Real-Time Breakout Detection: Once a range is established, the indicator monitors every tick (not just bar closes) for a breakout:
Bullish Breakout: Current price exceeds the Master Bar High → triggers BUY signal
Bearish Breakout: Current price drops below the Master Bar Low → triggers SELL signal
One-Shot Alert System: Each range produces exactly one alert. Once broken, the range is deactivated and no further alerts fire until a new Inside Bar forms and subsequently breaks.
Multi-Timeframe Scanning
The indicator uses request.security() to scan six higher timeframes simultaneously:
M30, H1, H2, H4, H8, H12
Each timeframe maintains independent state tracking, so a breakout on H4 does not affect H1 detection.
Dashboard Display
The built-in table displays real-time status for each symbol/timeframe combination:
RNG (Gray): Active range – volatility contraction in progress
BUY (Green): Bullish breakout detected
SELL (Red): Bearish breakout detected
- (Dark): No active pattern
How to Use
Add the indicator to any chart
Configure symbols in the "Extra Symbols" input group to monitor additional assets
Enable/disable timeframes in the "Timeframe Alerts" input group
Create a TradingView alert with the condition "Any alert() function call"
Trade the breakout — BUY signals indicate price has cleared resistance; SELL signals indicate price has broken support
Inputs
Show Range Lines: Toggle horizontal lines marking Master Bar high/low
Show BUY/SELL Labels: Toggle visual labels at breakout points
Show Dashboard Table: Toggle the multi-symbol status table
Range Line Color: Customize line color
Timeframe Toggles (M30–H12): Enable/disable alerts per timeframe
Symbol 1–4: Additional symbols to monitor
Important Notes
Alerts fire immediately on breakout (no waiting for candle close)
Only one alert per range – no repeat signals
Designed for forex, crypto, and futures markets
Works on all standard chart types
Phát hành các Ghi chú
Fixed the bug on Alerts SystemMã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.