OPEN-SOURCE SCRIPT

Momentum Burst Pullback System v66

124
* 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.

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.