OPEN-SOURCE SCRIPT
Momentum Burst Pullback System v66

* Detects **momentum “bursts”** using:
* **Keltner breakout** (high above upper band for long, low below lower band for short), and/or
* **MACD histogram extreme** (highest/lowest in a lookback window, with correct sign).
* Optional **burst-zone extension** keeps the burst “active” for N extra bars after the burst.
* Marks bursts with **K** (Keltner) and **M** (MACD) labels:
* Core burst labels use one color, extension labels use a different color.
* Tracks the most recent burst as the **dominant side** (long or short), and stores burst “leg” anchors (high/low context).
* Adds **structure-based invalidation**:
* On a new **core burst**, it locks the most recent **confirmed swing** level (pivot):
* Long: locks the last confirmed **swing low**.
* Short: locks the last confirmed **swing high**.
* After the burst, if price **breaks that locked level**, the burst regime is **cancelled** (and any pending setup on that side is dropped).
* Finds **pullback setups** after a dominant burst (and not inside the active burst zone), within min/max bars:
* Long pullback requires a sequence of **lower highs** and price still below the burst high.
* Short pullback requires **higher lows** and price still above the burst low.
* Optional background shading highlights pullback bars.
* On pullback bars, plots **static TP/SL crosses** using ATR:
* Anchor is the pullback bar’s high (long) or low (short).
* TP/SL are ± ATR * multiple.
* TP plots are visually classified (bright vs faded) based on whether TP would exceed the prior burst extreme.
* Maintains a **state-machine entry + trailing stop**:
* Sets a “waiting” trigger on pullback.
* Enters when price breaks the trigger (high break for long, low break for short).
* Trails a stop using **R-multiples**, with different behavior pre-break-even, post-break-even, and near-TP.
* Optionally draws the trailing stop as horizontal line segments.
* Optionally shows a **last-bar label** with the most recent pullback’s TP and SL values.
* **Keltner breakout** (high above upper band for long, low below lower band for short), and/or
* **MACD histogram extreme** (highest/lowest in a lookback window, with correct sign).
* Optional **burst-zone extension** keeps the burst “active” for N extra bars after the burst.
* Marks bursts with **K** (Keltner) and **M** (MACD) labels:
* Core burst labels use one color, extension labels use a different color.
* Tracks the most recent burst as the **dominant side** (long or short), and stores burst “leg” anchors (high/low context).
* Adds **structure-based invalidation**:
* On a new **core burst**, it locks the most recent **confirmed swing** level (pivot):
* Long: locks the last confirmed **swing low**.
* Short: locks the last confirmed **swing high**.
* After the burst, if price **breaks that locked level**, the burst regime is **cancelled** (and any pending setup on that side is dropped).
* Finds **pullback setups** after a dominant burst (and not inside the active burst zone), within min/max bars:
* Long pullback requires a sequence of **lower highs** and price still below the burst high.
* Short pullback requires **higher lows** and price still above the burst low.
* Optional background shading highlights pullback bars.
* On pullback bars, plots **static TP/SL crosses** using ATR:
* Anchor is the pullback bar’s high (long) or low (short).
* TP/SL are ± ATR * multiple.
* TP plots are visually classified (bright vs faded) based on whether TP would exceed the prior burst extreme.
* Maintains a **state-machine entry + trailing stop**:
* Sets a “waiting” trigger on pullback.
* Enters when price breaks the trigger (high break for long, low break for short).
* Trails a stop using **R-multiples**, with different behavior pre-break-even, post-break-even, and near-TP.
* Optionally draws the trailing stop as horizontal line segments.
* Optionally shows a **last-bar label** with the most recent pullback’s TP and SL values.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.