OPEN-SOURCE SCRIPT

Momentum Burst Pullback System v66

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

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.