This library is a Pine Script™ programmer’s tool for incorporating TradingView's well-known technical ratings within their scripts. The ratings produced by this library are the same as those from the speedometers in the technical analysis summary and the "Rating" indicator in the Screener, which use the aggregate biases of 26 technical indicators to calculate their results.
█ CONCEPTS
Ensemble analysis
Ensemble analysis uses multiple weaker models to produce a potentially stronger one. A common form of ensemble analysis in technical analysis is the usage of aggregate indicators together in hopes of gaining further market insight and reinforcing trading decisions.
Technical ratings
Technical ratings provide a simplified way to analyze financial markets by combining signals from an ensemble of indicators into a singular value, allowing traders to assess market sentiment more quickly and conveniently than analyzing each constituent separately. By consolidating the signals from multiple indicators into a single rating, traders can more intuitively and easily interpret the "technical health" of the market.
Calculating the rating value
Using a variety of built-in TA functions and functions from our ta library, this script calculates technical ratings for moving averages, oscillators, and their overall result within the `calcRatingAll()` function.
The function uses the script's `calcRatingMA()` function to calculate the moving average technical rating from an ensemble of 15 moving averages and filters: • Six Simple Moving Averages and six Exponential Moving Averages with periods of 10, 20, 30, 50, 100, and 200 • A Hull Moving Average with a period of 9 • A Volume-Weighted Moving Average with a period of 20 • An Ichimoku Cloud with a conversion line length of 9, base length of 26, and leading span B length of 52
The function uses the script's `calcRating()` function to calculate the oscillator technical rating from an ensemble of 11 oscillators: • RSI with a period of 14 • Stochastic with a %K period of 14, a smoothing period of 3, and a %D period of 3 • CCI with a period of 20 • ADX with a DI length of 14 and an ADX smoothing period of 14 • Awesome Oscillator • Momentum with a period of 10 • MACD with fast, slow, and signal periods of 12, 26, and 9 • Stochastic RSI with an RSI period of 14, a %K period of 14, a smoothing period of 3, and a %D period of 3 • Williams %R with a period of 14 • Bull Bear Power with a period of 50 • Ultimate Oscillator with fast, middle, and slow lengths of 7, 14, and 28
Each indicator is assigned a value of +1, 0, or -1, representing a bullish, neutral, or bearish rating. The moving average rating is the mean of all ratings that use the `calcRatingMA()` function, and the oscillator rating is the mean of all ratings that use the `calcRating()` function. The overall rating is the mean of the moving average and oscillator ratings, which ranges between +1 and -1. This overall rating, along with the separate MA and oscillator ratings, can be used to gain insight into the technical strength of the market. For a more detailed breakdown of the signals and conditions used to calculate the indicators' ratings, consult our Help Center explanation.
Determining rating status
The `ratingStatus()` function produces a string representing the status of a series of ratings. The `strongBound` and `weakBound` parameters, with respective default values of 0.5 and 0.1, define the bounds for "strong" and "weak" ratings.
By customizing the `strongBound` and `weakBound` values, traders can tailor the `ratingStatus()` function to fit their trading style or strategy, leading to a more personalized approach to evaluating ratings.
calcRatingAll() Calculates 3 ratings (ratings total, MA ratings, indicator ratings) using the aggregate biases of 26 different technical indicators. Returns: A 3-element tuple: ([][(float) ratingTotal, (float) ratingOther, (float) ratingMA[]].
countRising(plot) Calculates the number of times the values in the given series increase in value up to a maximum count of 5. Parameters: plot: (series float) The series of values to check for rising values. Returns: (int) The number of times the values in the series increased in value.
ratingStatus(ratingValue, strongBound, weakBound) Determines the rating status of a given series based on its values and defined bounds. Parameters: ratingValue: (series float) The series of values to determine the rating status for. strongBound: (series float) The upper bound for a "strong" rating. weakBound: (series float) The upper bound for a "weak" rating. Returns: (string) The rating status of the given series ("Strong Buy", "Buy", "Neutral", "Sell", or "Strong Sell").
リリースノート
v2
This version release comes with the following changes:
• This library now uses the latest version of the ta library. • We've resolved a minor issue with the sell signal for the Ichimoku Cloud. The previous version allowed a sell signal when the close price was inside the cloud, which is unintended behavior. This version allows an Ichimoku sell signal only when the price is below the cloud.
リリースノート
v3
We have upgraded this library to Pine Script™ v6, ensuring compatibility with the latest features and improvements. See the Release notes and Migration guide to learn what's new in v6 and how to convert your scripts to this version.
This release also includes several updates to the technical conditions used in the rating calculations, aligning with the updated methods in the "Technicals" section of the Screener and our symbol summary pages. These adjustments aim to provide more consistent ratings with fewer "Neutral" recommendations.