OPEN-SOURCE SCRIPT
Alpha TRIX Strategy >_

The Alpha TRIX Strategy is a precision trend-following system built on a deceptively simple but powerful principle: only trade when the market is genuinely trending, genuinely moving, and genuinely tilted in your direction. It achieves this by stacking three independent validation layers — a momentum signal (TRIX), a regime filter (Choppiness Index), and a directional strength filter (ADX) — before a single entry is placed.
Unlike raw TRIX crossover systems that fire indiscriminately, this strategy demands that all three conditions are simultaneously satisfied. The result is a lower-frequency, higher-conviction signal profile that avoids the whipsaw-heavy environments where pure momentum strategies bleed equity.
═══════════════════════════════════════
KEY FEATURES
═══════════════════════════════════════
Momentum Engine (TRIX)
— Triple-smoothed EMA eliminates high-frequency noise
— ROC of EMA³ isolates trend acceleration
— Zero-line crossover generates long and short triggers
— Configurable TRIX length for sensitivity tuning
Regime Filter — Choppiness Index
— CHOP < threshold confirms non-choppy, directional structure
— Blocks entries during range-bound, sideways markets
— Eliminates the most expensive entry environment for trend-following systems
Directional Filter — ADX
— ADX > minimum threshold confirms trend force is sufficient
— Calculated via full DMI (DI+ / DI−)
— Guards against weak-trend entries that stall post-entry
ATR% Exit Framework
— Take profit and stop loss scaled to realized volatility at entry
— Levels locked at execution candle — no mid-trade recalculation
— Independent TP and SL multipliers for asymmetric risk configuration
Trade Direction Control
— Long only, short only, or both — configurable at runtime
═══════════════════════════════════════
HOW IT WORKS
═══════════════════════════════════════
Step 1 — TRIX Signal
EMA is applied three times to close price, producing EMA³. Rate-of-change of EMA³ over 1 bar yields the TRIX value. A crossover above zero triggers a long; a crossunder triggers a short.
Step 2 — Choppiness Gate
The Choppiness Index measures the ratio of summed 1-bar ATR to the total high-low range over the lookback window, log-normalized. Values below the threshold indicate the market is exhibiting directional structure rather than random oscillation.
Step 3 — ADX Gate
ADX above the minimum confirms that whatever direction the market is moving, it is doing so with sufficient force. Both filters must pass simultaneously with the TRIX signal for entry to execute.
Step 4 — Entry and Exit
Entry is placed immediately. Take profit and stop loss are calculated as Close × (ATR / Close) × Multiplier — which resolves to ATR × Multiplier — and passed directly to strategy.exit() at the entry bar. This prevents dynamic recalculation from altering risk parameters mid-trade, closing the gap between backtested and live performance.
═══════════════════════════════════════
DESIGN RATIONALE
═══════════════════════════════════════
The TRIX advantage: triple-smoothing suppresses noise while the ROC step converts price level into momentum velocity. The zero-line crossing represents a genuine shift in trend acceleration — a higher-quality signal than single or double EMA crossovers.
Why CHOP + ADX? Each filter attacks a different failure mode. The Choppiness Index identifies range-bound structure where momentum signals are statistically unreliable. ADX addresses weak-trend environments where the market has a direction but insufficient force to sustain movement. Together they gate out the two most expensive entry environments for trend-following systems.
Locked exits: TP and SL are calculated once at the entry bar and immediately committed to the broker. This design closes a common source of backtest-to-live divergence in ATR-based systems — where dynamic recalculation on subsequent bars silently shifts risk levels mid-trade.
Unlike raw TRIX crossover systems that fire indiscriminately, this strategy demands that all three conditions are simultaneously satisfied. The result is a lower-frequency, higher-conviction signal profile that avoids the whipsaw-heavy environments where pure momentum strategies bleed equity.
═══════════════════════════════════════
KEY FEATURES
═══════════════════════════════════════
Momentum Engine (TRIX)
— Triple-smoothed EMA eliminates high-frequency noise
— ROC of EMA³ isolates trend acceleration
— Zero-line crossover generates long and short triggers
— Configurable TRIX length for sensitivity tuning
Regime Filter — Choppiness Index
— CHOP < threshold confirms non-choppy, directional structure
— Blocks entries during range-bound, sideways markets
— Eliminates the most expensive entry environment for trend-following systems
Directional Filter — ADX
— ADX > minimum threshold confirms trend force is sufficient
— Calculated via full DMI (DI+ / DI−)
— Guards against weak-trend entries that stall post-entry
ATR% Exit Framework
— Take profit and stop loss scaled to realized volatility at entry
— Levels locked at execution candle — no mid-trade recalculation
— Independent TP and SL multipliers for asymmetric risk configuration
Trade Direction Control
— Long only, short only, or both — configurable at runtime
═══════════════════════════════════════
HOW IT WORKS
═══════════════════════════════════════
Step 1 — TRIX Signal
EMA is applied three times to close price, producing EMA³. Rate-of-change of EMA³ over 1 bar yields the TRIX value. A crossover above zero triggers a long; a crossunder triggers a short.
Step 2 — Choppiness Gate
The Choppiness Index measures the ratio of summed 1-bar ATR to the total high-low range over the lookback window, log-normalized. Values below the threshold indicate the market is exhibiting directional structure rather than random oscillation.
Step 3 — ADX Gate
ADX above the minimum confirms that whatever direction the market is moving, it is doing so with sufficient force. Both filters must pass simultaneously with the TRIX signal for entry to execute.
Step 4 — Entry and Exit
Entry is placed immediately. Take profit and stop loss are calculated as Close × (ATR / Close) × Multiplier — which resolves to ATR × Multiplier — and passed directly to strategy.exit() at the entry bar. This prevents dynamic recalculation from altering risk parameters mid-trade, closing the gap between backtested and live performance.
═══════════════════════════════════════
DESIGN RATIONALE
═══════════════════════════════════════
The TRIX advantage: triple-smoothing suppresses noise while the ROC step converts price level into momentum velocity. The zero-line crossing represents a genuine shift in trend acceleration — a higher-quality signal than single or double EMA crossovers.
Why CHOP + ADX? Each filter attacks a different failure mode. The Choppiness Index identifies range-bound structure where momentum signals are statistically unreliable. ADX addresses weak-trend environments where the market has a direction but insufficient force to sustain movement. Together they gate out the two most expensive entry environments for trend-following systems.
Locked exits: TP and SL are calculated once at the entry bar and immediately committed to the broker. This design closes a common source of backtest-to-live divergence in ATR-based systems — where dynamic recalculation on subsequent bars silently shifts risk levels mid-trade.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.