OPEN-SOURCE SCRIPT

Impulse Convexity Trend Gate [T1][T69]

223
OVERVIEW 🧭
• A price-only trend engine that opens a “gate” only when trend strength, acceleration, and impulse dominance align.
• Built from three cooperating parts: adaptive slope, directional convexity, and an impulse-vs-pullback ratio.
• Output is a bounded oscillator (−100…+100) plus side-specific gate states (bull/bear), with optional pullback and weakness highlights.

THE IDEA & USEFULNESS 🧪
• Not a simple mashup: each component plays a distinct role—slope for direction, convexity for acceleration agreement, and an impulse ratio to suppress correction noise.
• Adaptive EMA length (series-based) lets the midline adjust to conditions without external indicators.
• Approximation of hyperbolic tangent and clamp keep signals bounded and stable while avoiding library dependencies.
• Designed to help trend traders act only when continuation is likely, and stand down during pullbacks or chop.

HOW IT WORKS (PIPELINE) ⚙️
• Price transform
• Uses log price for scale stability.
• Adaptive midline
• Volatility-aware EMA length is clamped between minimum and maximum, then applied via a custom recursive EMA.
• Slope & convexity
• Slope (first difference of the midline) defines direction; convexity (second difference) verifies acceleration agrees with that direction.
• Impulse vs pullback ratio (R)
• Sums directional progress versus counter-direction pullbacks over a window; requires impulse to dominate.
• Normalization & score
• Slope and convexity are normalized by recent dispersion; combined into a raw score and squashed to −100…+100 using manual tanh.
• Trend gate
• Gate opens only when: R ≥ threshold, |normalized slope| ≥ threshold, and slope/convexity share the same sign.
• States & visuals
• Bull/Bear Gate Entry when gate is open, oscillator crosses ±15 in the correct direction, price is on the correct side of the midline, and slope/convexity agree.
• Pullbacks mark counter-moves while a gate is active; Weakness flags specific fade patterns after pullbacks.

FEATURES ✨
• Bull and Bear Gate Entries (green/red columns).
• Pullback shading and optional trend-weakness highlights (yellow/orange + teal/maroon).
• Background tint reflects the active side (bull or bear).
• Pure price logic; no volume or external filters required.

HOW TO USE 🎯
• Regime filter
• Trade only in the direction of the open gate; ignore signals when the gate is closed.
• Pullback entries
• During an open gate, wait for a pullback zone, then act on trend-resumption (e.g., oscillator re-push through ±15 or structure break in gate direction).
• Exits & risk
• Consider trimming when the oscillator relaxes toward 0 while the gate remains open, or when convexity flips against slope and R deteriorates.
• Timeframes & markets
• Suited for trend following on crypto/FX/indices from M30 to 4H/1D; raise thresholds on lower timeframes to reduce noise.

CONFIGURATION 🔧
• Impulse ratio gate (R ≥): raises/lowers the standard for continuation dominance.
• Slope strength gate (|sN| ≥): controls how strong a slope must be to count.
• Show Pullback Impulse (toggle): enable/disable pullback highlights.
• Show Trend Weakness (toggle): enable/disable weakness flags.

LIMITATIONS ⚠️
• As a trend tool, it can lag at regime transitions; expect whipsaws in tight ranges.
• Parameters are instrument- and timeframe-dependent; tune thresholds before live use.
• Pullback/weakness flags are contextual—not trade signals by themselves; use them with gate state and your execution rules.

ADVANCED TIPS 🛠️
• Tighten R and slope thresholds for lower timeframes; loosen for higher timeframes.
• Pair with NNFX-style money management and pair-level filters; let the gate be the confirmation layer, not the entry trigger by itself.
• Batch-test across 100+ symbols, export metrics, and run Monte Carlo to validate LLN reliability and Sharpe/IQR stability.
• For system hedging, disable entries when both sides trigger on the same asset to avoid internal conflict.

NOTES 📝
• Price-only construction reduces data-vendor differences and keeps behavior consistent across markets.
• Manual tanh/clamp ensure stable, bounded scores even during extremes.

DISCLAIMER 🛡️
• For research and education. No financial advice. Test thoroughly, size conservatively, and respect your risk rules.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.