OPEN-SOURCE SCRIPT

TPI | TRW

512
⯁ OVERVIEW
The TPI | TRW indicator is a custom momentum and trend strength tool designed to assess the prevailing market trend by averaging price data over a flexible period. It generates a score based on how the current price compares to a range of moving averages (SMAs, WMAs), and it normalizes this score to highlight the strength and direction of the trend.

◆ KEY FEATURES
  • Trend Strength Scoring: Calculates a score by comparing the current price to multiple SMAs, providing a quantitative measure of trend strength.
    Pine Script®
    array<float> values = array.new<float>() float score = 0. for i = 0 to period by 1 float ma = switch i_maType "SMA" => ta.sma(close, period+i) "WMA" => ta.wma(close, period+i) values.push(ma) for s in values if close > s score += 1 for s in values if close < s score -= 1
  • Dynamic Range Normalization: Normalizes the trend score to a range between -1 and 1, simplifying the interpretation of trend strength.
  • Visual Trend Gradient: Utilizes a color gradient to represent the trend direction and intensity, offering an intuitive visual cue for trend analysis.
    syot kilat
  • Customizable Lookback Period: Allows users to adjust the lookback period, enabling the indicator to be tailored to different market conditions and trading styles.


◆ USAGE
  • Trend Confirmation: Use the score to confirm the direction and strength of the current market trend.
  • Reversal Detection: Monitor changes in the score and color gradient for potential trend reversals or weakening momentum. (Green - uptrend, Yellow - ranging, Red - downtrend)
    syot kilat


⯁ CONCLUSION
The TPI | TRW indicator offers traders a versatile tool for assessing market momentum and trend strength. By leveraging a custom scoring system that compares the current price to a series of MAs, it provides valuable insights into market dynamics, helping traders make more informed decisions.

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.