OPEN-SOURCE SCRIPT
تم تحديثه TRIX | TR

🎯 Overview
TRIX | TR is a sophisticated momentum oscillator that applies triple smoothing to price data to filter out insignificant price movements and identify meaningful trend changes. Developed by Tiagorocha1989, this enhanced version of Jack Hutson's classic TRIX indicator offers dual-mode operation with customizable moving averages and comprehensive visual features, helping traders identify trend direction, momentum shifts, and potential reversal points with reduced noise and greater precision.
🔧 How It Works
The TRIX indicator applies triple exponential smoothing to price data, then calculates the percentage rate of change of this smoothed series. This process eliminates short-term cycles and noise while highlighting the underlying trend and momentum.
Core Calculation Logic:
The indicator follows a multi-step smoothing process:
Logarithmic Transformation: The price source is converted to its natural logarithm (math.log), which helps normalize percentage changes and makes the indicator responsive to proportional price movements.
Triple Smoothing: The log price undergoes three consecutive smoothing operations using a user-selectable moving average:
First smoothing (ma1): Applied to the log price
Second smoothing (ma2): Applied to ma1
Third smoothing (ma3): Applied to ma2
Rate of Change Calculation: TRIX is calculated as the percentage rate of change of the triple-smoothed series:
TRIX = 10000 × (ma3 - ma3[1])
The multiplication by 10000 scales the values for better visibility
The resulting oscillator fluctuates around zero, with:
Positive TRIX values indicating upward momentum
Negative TRIX values indicating downward momentum
Zero line crossovers signaling potential trend changes
The indicator compares TRIX to a reference line that can be either:
The traditional zero level
A user-defined moving average of TRIX itself (TRIX MA mode)
✨ Key Features
🔹 Dual Operating Modes
Zero Line Mode: Classic TRIX implementation where signals occur when TRIX crosses above or below the zero line
TRIX MA Mode: Enhanced version where signals occur when TRIX crosses its own moving average, providing smoother, filtered entries
🔹 Flexible Moving Average Selection
Choose from six MA types for both the triple smoothing and the signal line:
EMA (Exponential Moving Average) for responsive signals
SMA (Simple Moving Average) for smoother readings
RMA (Rolling Moving Average) for weighted recent data
WMA (Weighted Moving Average) for customizable weighting
VWMA (Volume-Weighted Moving Average) incorporating volume
HMA (Hull Moving Average) for reduced lag
🔹 Customizable TRIX Parameters
Length TRIX: Lookback period for the moving averages (default 18)
Source TRIX: Price source for calculations (default Close)
MA Type: Moving average method used for all three smoothing steps
🔹 Logarithmic Processing
By applying TRIX to log prices rather than raw prices, the indicator responds proportionally to percentage changes, making it more consistent across different price levels and instruments.
🔹 Customizable Color Themes
Eight distinct color schemes to match your charting preferences:
Classic – Green for bullish, Red for bearish
Modern – White for bullish, Purple for bearish
Robust – Amber for bullish, Maroon for bearish
Accented – Violet for bullish, Pink for bearish
Monochrome – Light gray for bullish, Dark gray for bearish
Moderate – Green for bullish, Red for bearish
Aqua – Blue for bullish, Orange for bearish
Cosmic – Pink for bullish, Purple for bearish
🔹 Comprehensive Visual Feedback
Colored TRIX Line: Changes color based on position relative to the reference line
Signal Line: Yellow line showing zero or MA reference
Gradient Fill Zones: Clear visualization of extreme readings (+100 to -100)
Dynamic Zone Fills: Semi-transparent fills showing when TRIX is above or below the reference line
Color-Coded Candles: Bars reflect current TRIX bias (above or below reference)
Signal Markers: Triangle up/down symbols at crossover points
Live Value Display: Current TRIX value shown in a floating label
Trend Table: Bullish/Bearish status displayed on the chart
🔹 Ready-to-Use Alerts
Built-in alert conditions trigger LONG signals on bullish crossovers and SHORT signals on bearish crossunders across both operating modes.
⚙️ Settings Summary
Color Choice: Select from eight visual themes (Default: Classic)
Length TRIX: Lookback period for the triple smoothing (Default: 18)
Source TRIX: Price source for calculations (Default: Close)
Entry/Exit Signal: Choose between zero line or TRIX MA mode (Default: Zero Line)
MA Type: Moving average method for all smoothing steps (Default: EMA)
Length MA TRIX: Moving average period for TRIX MA mode (Default: 365)
📈 Practical Applications
🔹 Trend Direction Identification
The TRIX line's position relative to zero indicates trend direction:
TRIX above zero → Bullish trend
TRIX below zero → Bearish trend
The steepness of the slope indicates momentum strength
🔹 Zero Line Crossovers
In Zero Line mode, crossovers provide momentum signals:
Crossover above zero → Bullish momentum strengthening, potential trend reversal up
Crossunder below zero → Bearish momentum strengthening, potential trend reversal down
These signals often lead traditional moving average crossovers
🔹 Signal Line Crossovers
In TRIX MA mode, crossovers between TRIX and its moving average provide filtered signals:
TRIX crosses above its MA → Bullish signal
TRIX crosses below its MA → Bearish signal
These signals reduce whipsaws in choppy markets
🔹 Divergence Trading
TRIX is excellent for spotting divergences:
Bullish Divergence: Price makes lower low, TRIX makes higher low → Potential upside reversal
Bearish Divergence: Price makes higher high, TRIX makes lower high → Potential downside reversal
Divergences are most significant when occurring at extreme levels
🔹 Momentum Confirmation
The slope and magnitude of TRIX confirm momentum:
Steeply rising TRIX → Strong bullish momentum
Steeply falling TRIX → Strong bearish momentum
Flattening TRIX → Momentum slowing, potential trend change
🔹 Cycle Identification
The triple smoothing process removes short-term cycles, helping identify medium to longer-term cycles and trends:
Default length 18 is suitable for identifying intermediate-term cycles
Shorter lengths for shorter-term cycles
Longer lengths for major trend identification
🔹 Multiple Timeframe Analysis
Compare TRIX readings across different timeframes:
Higher timeframe TRIX confirms primary trend direction
Lower timeframe TRIX identifies entry timing and short-term momentum
🎯 Ideal For
✅ Trend Traders seeking to identify and follow established trends with reduced noise
✅ Momentum Traders wanting to measure the acceleration of price movements
✅ Divergence Traders looking for early reversal signals
✅ Swing Traders capturing medium-term momentum shifts
✅ Cycle Analysts identifying underlying price cycles
✅ System Developers needing reliable, smoothed momentum signals
📌 Key Takeaways
Triple Smoothing: The three-stage smoothing process eliminates insignificant price movements, revealing the underlying trend
Logarithmic Processing: Using log prices makes TRIX responsive to percentage changes, providing consistency across different price levels
Dual-Mode Flexibility: Choose between classic zero-line crossovers for traditional signals or MA-smoothed signals for filtered entries
Comprehensive Visualization: Color themes, gradient fills for extreme zones, candles, and labels provide immediate market awareness
Divergence Capability: Excellent for spotting both regular and hidden divergences that signal trend reversals or continuations
Alert-Ready: Built-in alerts for both LONG and SHORT signals across both operating modes
⚠️ Important Notes
TRIX is a smoothed indicator, meaning it will be slower to react than single-smoothed oscillators. This makes it better suited for identifying intermediate to longer-term trends rather than short-term entries. The default length of 18 provides a balance between responsiveness and smoothness. The multiplication by 10000 scales the values for better visibility but does not change the signal logic. The 365-day MA default in TRIX MA mode is designed for longer-term trend context on daily charts. Divergences are most reliable when they occur after extended trends. Always combine with proper risk management and additional confirmation for best results.
Disclaimer: This indicator is provided for educational and informational purposes only. Past performance is not indicative of future results. Always conduct thorough testing and align with your risk management strategy before live deployment.
TRIX | TR is a sophisticated momentum oscillator that applies triple smoothing to price data to filter out insignificant price movements and identify meaningful trend changes. Developed by Tiagorocha1989, this enhanced version of Jack Hutson's classic TRIX indicator offers dual-mode operation with customizable moving averages and comprehensive visual features, helping traders identify trend direction, momentum shifts, and potential reversal points with reduced noise and greater precision.
🔧 How It Works
The TRIX indicator applies triple exponential smoothing to price data, then calculates the percentage rate of change of this smoothed series. This process eliminates short-term cycles and noise while highlighting the underlying trend and momentum.
Core Calculation Logic:
The indicator follows a multi-step smoothing process:
Logarithmic Transformation: The price source is converted to its natural logarithm (math.log), which helps normalize percentage changes and makes the indicator responsive to proportional price movements.
Triple Smoothing: The log price undergoes three consecutive smoothing operations using a user-selectable moving average:
First smoothing (ma1): Applied to the log price
Second smoothing (ma2): Applied to ma1
Third smoothing (ma3): Applied to ma2
Rate of Change Calculation: TRIX is calculated as the percentage rate of change of the triple-smoothed series:
TRIX = 10000 × (ma3 - ma3[1])
The multiplication by 10000 scales the values for better visibility
The resulting oscillator fluctuates around zero, with:
Positive TRIX values indicating upward momentum
Negative TRIX values indicating downward momentum
Zero line crossovers signaling potential trend changes
The indicator compares TRIX to a reference line that can be either:
The traditional zero level
A user-defined moving average of TRIX itself (TRIX MA mode)
✨ Key Features
🔹 Dual Operating Modes
Zero Line Mode: Classic TRIX implementation where signals occur when TRIX crosses above or below the zero line
TRIX MA Mode: Enhanced version where signals occur when TRIX crosses its own moving average, providing smoother, filtered entries
🔹 Flexible Moving Average Selection
Choose from six MA types for both the triple smoothing and the signal line:
EMA (Exponential Moving Average) for responsive signals
SMA (Simple Moving Average) for smoother readings
RMA (Rolling Moving Average) for weighted recent data
WMA (Weighted Moving Average) for customizable weighting
VWMA (Volume-Weighted Moving Average) incorporating volume
HMA (Hull Moving Average) for reduced lag
🔹 Customizable TRIX Parameters
Length TRIX: Lookback period for the moving averages (default 18)
Source TRIX: Price source for calculations (default Close)
MA Type: Moving average method used for all three smoothing steps
🔹 Logarithmic Processing
By applying TRIX to log prices rather than raw prices, the indicator responds proportionally to percentage changes, making it more consistent across different price levels and instruments.
🔹 Customizable Color Themes
Eight distinct color schemes to match your charting preferences:
Classic – Green for bullish, Red for bearish
Modern – White for bullish, Purple for bearish
Robust – Amber for bullish, Maroon for bearish
Accented – Violet for bullish, Pink for bearish
Monochrome – Light gray for bullish, Dark gray for bearish
Moderate – Green for bullish, Red for bearish
Aqua – Blue for bullish, Orange for bearish
Cosmic – Pink for bullish, Purple for bearish
🔹 Comprehensive Visual Feedback
Colored TRIX Line: Changes color based on position relative to the reference line
Signal Line: Yellow line showing zero or MA reference
Gradient Fill Zones: Clear visualization of extreme readings (+100 to -100)
Dynamic Zone Fills: Semi-transparent fills showing when TRIX is above or below the reference line
Color-Coded Candles: Bars reflect current TRIX bias (above or below reference)
Signal Markers: Triangle up/down symbols at crossover points
Live Value Display: Current TRIX value shown in a floating label
Trend Table: Bullish/Bearish status displayed on the chart
🔹 Ready-to-Use Alerts
Built-in alert conditions trigger LONG signals on bullish crossovers and SHORT signals on bearish crossunders across both operating modes.
⚙️ Settings Summary
Color Choice: Select from eight visual themes (Default: Classic)
Length TRIX: Lookback period for the triple smoothing (Default: 18)
Source TRIX: Price source for calculations (Default: Close)
Entry/Exit Signal: Choose between zero line or TRIX MA mode (Default: Zero Line)
MA Type: Moving average method for all smoothing steps (Default: EMA)
Length MA TRIX: Moving average period for TRIX MA mode (Default: 365)
📈 Practical Applications
🔹 Trend Direction Identification
The TRIX line's position relative to zero indicates trend direction:
TRIX above zero → Bullish trend
TRIX below zero → Bearish trend
The steepness of the slope indicates momentum strength
🔹 Zero Line Crossovers
In Zero Line mode, crossovers provide momentum signals:
Crossover above zero → Bullish momentum strengthening, potential trend reversal up
Crossunder below zero → Bearish momentum strengthening, potential trend reversal down
These signals often lead traditional moving average crossovers
🔹 Signal Line Crossovers
In TRIX MA mode, crossovers between TRIX and its moving average provide filtered signals:
TRIX crosses above its MA → Bullish signal
TRIX crosses below its MA → Bearish signal
These signals reduce whipsaws in choppy markets
🔹 Divergence Trading
TRIX is excellent for spotting divergences:
Bullish Divergence: Price makes lower low, TRIX makes higher low → Potential upside reversal
Bearish Divergence: Price makes higher high, TRIX makes lower high → Potential downside reversal
Divergences are most significant when occurring at extreme levels
🔹 Momentum Confirmation
The slope and magnitude of TRIX confirm momentum:
Steeply rising TRIX → Strong bullish momentum
Steeply falling TRIX → Strong bearish momentum
Flattening TRIX → Momentum slowing, potential trend change
🔹 Cycle Identification
The triple smoothing process removes short-term cycles, helping identify medium to longer-term cycles and trends:
Default length 18 is suitable for identifying intermediate-term cycles
Shorter lengths for shorter-term cycles
Longer lengths for major trend identification
🔹 Multiple Timeframe Analysis
Compare TRIX readings across different timeframes:
Higher timeframe TRIX confirms primary trend direction
Lower timeframe TRIX identifies entry timing and short-term momentum
🎯 Ideal For
✅ Trend Traders seeking to identify and follow established trends with reduced noise
✅ Momentum Traders wanting to measure the acceleration of price movements
✅ Divergence Traders looking for early reversal signals
✅ Swing Traders capturing medium-term momentum shifts
✅ Cycle Analysts identifying underlying price cycles
✅ System Developers needing reliable, smoothed momentum signals
📌 Key Takeaways
Triple Smoothing: The three-stage smoothing process eliminates insignificant price movements, revealing the underlying trend
Logarithmic Processing: Using log prices makes TRIX responsive to percentage changes, providing consistency across different price levels
Dual-Mode Flexibility: Choose between classic zero-line crossovers for traditional signals or MA-smoothed signals for filtered entries
Comprehensive Visualization: Color themes, gradient fills for extreme zones, candles, and labels provide immediate market awareness
Divergence Capability: Excellent for spotting both regular and hidden divergences that signal trend reversals or continuations
Alert-Ready: Built-in alerts for both LONG and SHORT signals across both operating modes
⚠️ Important Notes
TRIX is a smoothed indicator, meaning it will be slower to react than single-smoothed oscillators. This makes it better suited for identifying intermediate to longer-term trends rather than short-term entries. The default length of 18 provides a balance between responsiveness and smoothness. The multiplication by 10000 scales the values for better visibility but does not change the signal logic. The 365-day MA default in TRIX MA mode is designed for longer-term trend context on daily charts. Divergences are most reliable when they occur after extended trends. Always combine with proper risk management and additional confirmation for best results.
Disclaimer: This indicator is provided for educational and informational purposes only. Past performance is not indicative of future results. Always conduct thorough testing and align with your risk management strategy before live deployment.
ملاحظات الأخبار
Resolution Previous Problemملاحظات الأخبار
Resolution Previous Problemنص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.