OPEN-SOURCE SCRIPT
TPI | TRW

⯁ 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
◆ USAGE
⯁ 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.
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.
- 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)
⯁ 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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.