OPEN-SOURCE SCRIPT
Squeeze Memory Cone [forexobroker]

Squeeze Memory Cone [forexobroker] detects a volatility squeeze when the Bollinger Bands sit fully inside the Keltner Channel, then projects a forward "memory cone" from the squeeze-release bar. The unique angle is that the cone half-width grows with the square root of bars elapsed since release, mirroring the typical post-squeeze expansion envelope, and that envelope plus the release direction frames every entry.
🔶 ALGORITHM
1. Build Bollinger Bands (SMA basis +/- stdev x BB mult) and a Keltner Channel (same basis +/- ATR-style range x KC mult) on the shared length.
2. Squeeze is ON when the upper BB is below the upper KC AND the lower BB is above the lower KC (volatility compression).
3. Release = squeeze was on last bar and is off this bar. On release, the linreg of detrended price (close minus its SMA) gives the expansion direction, which sets the bias; the release close anchors the cone base.
4. Project the memory cone forward: half-width = Cone Width x ATR x sqrt(bars since release), bounded by Cone Life bars. The cone is a sqrt-time expansion envelope, not a forecast line.
5. Entry timing: in Release-Only mode the signal is the directional release bar itself; otherwise, while the cone is active and bias is set, a close crossover (long) or crossunder (short) of the reclaim EMA times the entry. Cooldown, position-lock, and bar-close confirmation apply. Non-repainting.
🔶 SIGNAL LOGIC
- Buy: in-session AND ((Release-Only: squeeze released with positive momentum) OR (cone active AND bias = +1 AND close crosses over the reclaim EMA)) AND position not already long AND cooldown elapsed AND barstate.isconfirmed (then position locks long).
- Sell: in-session AND ((Release-Only: squeeze released with negative momentum) OR (cone active AND bias = -1 AND close crosses under the reclaim EMA)) AND position not already short AND cooldown elapsed AND barstate.isconfirmed (then position locks short).
- Only fires while the projected memory cone is active (or on the release bar in Release-Only mode).
🔶 INPUTS
- Squeeze group: shared length for Bollinger Bands and Keltner Channel; default BB/KC Length 20.
- BB width: standard-deviation multiplier for the Bollinger Bands; default BB StdDev Mult 2.0.
- KC width: ATR-range multiplier for the Keltner Channel; default KC ATR Mult 1.5.
- Cone life: bars the projected cone stays active after release; default Cone Life 30.
- Cone width: k in the k x ATR x sqrt(bars) half-width; default Cone Width x ATR 1.0.
- Volatility reference: ATR length for cone width and dashboard; default ATR Length 20.
- Signal Logic group: entry reclaim EMA, release-only mode, cooldown; default Entry Reclaim EMA 9.
- Cooldown: minimum bars between signals; default Cooldown Bars 5.
- Filters group: optional session restriction and session window; default Restrict to Session off.
- Visual group: memory cone, dashboard, 3-layer glow, buy/sell colors, dashboard background.
🔶 ALERTS
SMQ Buy, SMQ Sell, SMQ Any Signal, SMQ Squeeze On, SMQ Release, SMQ Release Up, SMQ Release Down, SMQ EMA Up, SMQ EMA Down, SMQ Cone Open, SMQ Cone Expire, SMQ Bias Flip, SMQ Webhook JSON.
🔶 LIMITATIONS
- The squeeze/cone logic needs a full BB/KC length to stabilise, so the first length bars are warm-up.
- The memory cone is a sqrt-time heuristic envelope of expected expansion, not a price forecast or target.
- Release direction is taken from a linreg of detrended price on the release bar and can be marginal when momentum is near zero.
- Default multipliers are tuned for liquid instruments; gappy symbols can trigger or break squeezes abruptly.
- Entries confirm on bar close, so the reclaim-EMA cross is acknowledged with one-bar lag versus intrabar price.
🔶 ALGORITHM
1. Build Bollinger Bands (SMA basis +/- stdev x BB mult) and a Keltner Channel (same basis +/- ATR-style range x KC mult) on the shared length.
2. Squeeze is ON when the upper BB is below the upper KC AND the lower BB is above the lower KC (volatility compression).
3. Release = squeeze was on last bar and is off this bar. On release, the linreg of detrended price (close minus its SMA) gives the expansion direction, which sets the bias; the release close anchors the cone base.
4. Project the memory cone forward: half-width = Cone Width x ATR x sqrt(bars since release), bounded by Cone Life bars. The cone is a sqrt-time expansion envelope, not a forecast line.
5. Entry timing: in Release-Only mode the signal is the directional release bar itself; otherwise, while the cone is active and bias is set, a close crossover (long) or crossunder (short) of the reclaim EMA times the entry. Cooldown, position-lock, and bar-close confirmation apply. Non-repainting.
🔶 SIGNAL LOGIC
- Buy: in-session AND ((Release-Only: squeeze released with positive momentum) OR (cone active AND bias = +1 AND close crosses over the reclaim EMA)) AND position not already long AND cooldown elapsed AND barstate.isconfirmed (then position locks long).
- Sell: in-session AND ((Release-Only: squeeze released with negative momentum) OR (cone active AND bias = -1 AND close crosses under the reclaim EMA)) AND position not already short AND cooldown elapsed AND barstate.isconfirmed (then position locks short).
- Only fires while the projected memory cone is active (or on the release bar in Release-Only mode).
🔶 INPUTS
- Squeeze group: shared length for Bollinger Bands and Keltner Channel; default BB/KC Length 20.
- BB width: standard-deviation multiplier for the Bollinger Bands; default BB StdDev Mult 2.0.
- KC width: ATR-range multiplier for the Keltner Channel; default KC ATR Mult 1.5.
- Cone life: bars the projected cone stays active after release; default Cone Life 30.
- Cone width: k in the k x ATR x sqrt(bars) half-width; default Cone Width x ATR 1.0.
- Volatility reference: ATR length for cone width and dashboard; default ATR Length 20.
- Signal Logic group: entry reclaim EMA, release-only mode, cooldown; default Entry Reclaim EMA 9.
- Cooldown: minimum bars between signals; default Cooldown Bars 5.
- Filters group: optional session restriction and session window; default Restrict to Session off.
- Visual group: memory cone, dashboard, 3-layer glow, buy/sell colors, dashboard background.
🔶 ALERTS
SMQ Buy, SMQ Sell, SMQ Any Signal, SMQ Squeeze On, SMQ Release, SMQ Release Up, SMQ Release Down, SMQ EMA Up, SMQ EMA Down, SMQ Cone Open, SMQ Cone Expire, SMQ Bias Flip, SMQ Webhook JSON.
🔶 LIMITATIONS
- The squeeze/cone logic needs a full BB/KC length to stabilise, so the first length bars are warm-up.
- The memory cone is a sqrt-time heuristic envelope of expected expansion, not a price forecast or target.
- Release direction is taken from a linreg of detrended price on the release bar and can be marginal when momentum is near zero.
- Default multipliers are tuned for liquid instruments; gappy symbols can trigger or break squeezes abruptly.
- Entries confirm on bar close, so the reclaim-EMA cross is acknowledged with one-bar lag versus intrabar price.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
🔵Gain access to our powerful tools : forexobroker.com/tv
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
🔵Gain access to our powerful tools : forexobroker.com/tv
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.