OPEN-SOURCE SCRIPT

Alpha TRIX Strategy >_

1 313
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.

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。