PROTECTED SOURCE SCRIPT
تم تحديثه Trinity Moving Average Slope

The Trinity Moving Average Slope indicator quantifies the steepness of a moving average's direction in a dedicated oscillator pane on TradingView. It normalizes this slope with ATR to ensure consistent readings across varying assets, volatilities, and timeframes, enabling traders to distinguish robust trends from sideways or choppy markets objectively.
Calculation Method
The process starts by calculating a primary moving average based on the selected type and length (default: 16-period HMA on ohlc4 source). It then determines the one-bar change in this MA value, divides it by the ATR (default length 10) for volatility normalization, applies the arctangent function, and converts the result to degrees. This produces a slope angle that typically oscillates between roughly -10° and +10°, with higher absolute values indicating steeper trends.
Visual Elements and Interpretation
The main slope line appears with dynamic coloring: bright green for values above the top threshold (default +2°), signifying a strong uptrend; red below the bottom threshold (default -2°), for strong downtrends; and gray in the neutral zone between them. Horizontal lines mark these thresholds, along with a dotted zero line for quick reference on trend direction changes.
Usage Guidelines
Traders primarily use this as a trend strength filter—favor long positions or continuations when the line sustains green, shorts or profit-taking in red, and stand aside during gray periods to avoid false trend signals in ranging conditions. Zero-line crosses serve as early warnings of momentum shifts, while the built-in alerts notify on strong trend activations or these crosses.
Highlight: Secondary Moving Average
An optional secondary MA (toggleable, default off) smooths the slope line itself, functioning like a signal line (default: 14-period EMA in yellow). Enabling it introduces crossover opportunities: the main slope crossing above the secondary MA suggests accelerating bullish momentum, while crossing below indicates potential bearish slowdowns or reversals. This adds confirmation and helps filter noise, especially useful in volatile markets.
Available Moving Average Types
Both the main (slope-generating) MA and the secondary MA offer the same six types, each with distinct characteristics for different trading styles:
SMA (Simple Moving Average): Equal weighting to all periods—smooth but with significant lag, ideal for identifying long-term trends.
EMA (Exponential Moving Average): Greater weight to recent prices—responsive with moderate lag, a balanced choice for most trend-following setups.
WMA (Weighted Moving Average): Linear weighting favoring newer data—faster than SMA but smoother than EMA, good for intermediate responsiveness.
HMA (Hull Moving Average): Engineered to reduce lag while maintaining smoothness—highly responsive, excellent for shorter timeframes or catching early trend changes (default in the main MA here).
RMA (Running Moving Average): Similar to EMA but with adjustable alpha—robust and less prone to overshooting in wild swings.
VWMA (Volume Weighted Moving Average): Weights by volume—useful in stock trading where volume confirms price moves, emphasizing high-activity periods.
Suggested Settings
For stocks (slower moves): Use longer main lengths like 30-50 with EMA or HMA on daily charts, or 20-34 on intraday, keeping thresholds around ±2° to ±3°.
For crypto (faster action): Opt for shorter lengths like 10-20 with HMA for responsiveness, ATR 10, and thresholds ±1.8° to ±2.5°; enable the secondary EMA for extra signal confirmation on 15-min to 4H charts. Experiment to match your risk tolerance.
Calculation Method
The process starts by calculating a primary moving average based on the selected type and length (default: 16-period HMA on ohlc4 source). It then determines the one-bar change in this MA value, divides it by the ATR (default length 10) for volatility normalization, applies the arctangent function, and converts the result to degrees. This produces a slope angle that typically oscillates between roughly -10° and +10°, with higher absolute values indicating steeper trends.
Visual Elements and Interpretation
The main slope line appears with dynamic coloring: bright green for values above the top threshold (default +2°), signifying a strong uptrend; red below the bottom threshold (default -2°), for strong downtrends; and gray in the neutral zone between them. Horizontal lines mark these thresholds, along with a dotted zero line for quick reference on trend direction changes.
Usage Guidelines
Traders primarily use this as a trend strength filter—favor long positions or continuations when the line sustains green, shorts or profit-taking in red, and stand aside during gray periods to avoid false trend signals in ranging conditions. Zero-line crosses serve as early warnings of momentum shifts, while the built-in alerts notify on strong trend activations or these crosses.
Highlight: Secondary Moving Average
An optional secondary MA (toggleable, default off) smooths the slope line itself, functioning like a signal line (default: 14-period EMA in yellow). Enabling it introduces crossover opportunities: the main slope crossing above the secondary MA suggests accelerating bullish momentum, while crossing below indicates potential bearish slowdowns or reversals. This adds confirmation and helps filter noise, especially useful in volatile markets.
Available Moving Average Types
Both the main (slope-generating) MA and the secondary MA offer the same six types, each with distinct characteristics for different trading styles:
SMA (Simple Moving Average): Equal weighting to all periods—smooth but with significant lag, ideal for identifying long-term trends.
EMA (Exponential Moving Average): Greater weight to recent prices—responsive with moderate lag, a balanced choice for most trend-following setups.
WMA (Weighted Moving Average): Linear weighting favoring newer data—faster than SMA but smoother than EMA, good for intermediate responsiveness.
HMA (Hull Moving Average): Engineered to reduce lag while maintaining smoothness—highly responsive, excellent for shorter timeframes or catching early trend changes (default in the main MA here).
RMA (Running Moving Average): Similar to EMA but with adjustable alpha—robust and less prone to overshooting in wild swings.
VWMA (Volume Weighted Moving Average): Weights by volume—useful in stock trading where volume confirms price moves, emphasizing high-activity periods.
Suggested Settings
For stocks (slower moves): Use longer main lengths like 30-50 with EMA or HMA on daily charts, or 20-34 on intraday, keeping thresholds around ±2° to ±3°.
For crypto (faster action): Opt for shorter lengths like 10-20 with HMA for responsiveness, ATR 10, and thresholds ±1.8° to ±2.5°; enable the secondary EMA for extra signal confirmation on 15-min to 4H charts. Experiment to match your risk tolerance.
ملاحظات الأخبار
Added upper and lower thresholds and additional alertsنص برمجي محمي
تم نشر هذا النص البرمجي كمصدر مغلق. ومع ذلك، يمكنك استخدامه بحرية ودون أي قيود - تعرف على المزيد هنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي محمي
تم نشر هذا النص البرمجي كمصدر مغلق. ومع ذلك، يمكنك استخدامه بحرية ودون أي قيود - تعرف على المزيد هنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.