The True Strength Index (TSI) is a momentum oscillator that helps traders identify trends and potential reversal points in the market. Here’s how it works:
1. **Price Change Calculation**: - **`pc = ta.change(price)`**: This calculates the change in price (current price minus the previous price).
2. **Double Smoothing**: - **`double_smooth(src, long, short)`**: This function smooths the price change data twice using two Exponential Moving Averages (EMAs): - The first EMA smooths the raw data. - The second EMA smooths the result of the first EMA. - **`double_smoothed_pc`**: The double-smoothed price change. - **`double_smoothed_abs_pc`**: The double-smoothed absolute price change, which helps normalize the TSI value.
3. **TSI Calculation**: - **`tsi_value = 100 * (double_smoothed_pc / double_smoothed_abs_pc)`**: This calculates the TSI by dividing the double-smoothed price change by the double-smoothed absolute price change, then multiplying by 100 to scale the value. - The TSI oscillates around the zero line, indicating momentum. Positive values suggest bullish momentum, while negative values suggest bearish momentum.
4. **Signal Line**: - **`signal_line = ta.ema(tsi_value, signal)`**: This creates a signal line by applying another EMA to the TSI value. The signal line is typically used to identify entry and exit points.
5. **Buy and Sell Signals**: - **Buy Signal**: Occurs when the TSI crosses above the signal line (`ta.crossover(tsi_value, signal_line)`), indicating that bullish momentum is strengthening, which might suggest a buying opportunity. - **Sell Signal**: Occurs when the TSI crosses below the signal line (`ta.crossunder(tsi_value, signal_line)`), indicating that bearish momentum is strengthening, which might suggest a selling opportunity.
6. **Visual Representation**: - The TSI line and the signal line are plotted on the chart. - Buy signals are marked with green "BUY" labels below the bars, and sell signals are marked with red "SELL" labels above the bars.
**How to Use It**: - **Trend Identification**: When the TSI is above zero, it suggests an uptrend; when it's below zero, it suggests a downtrend. - **Buy/Sell Signals**: Traders often enter a buy trade when the TSI crosses above the signal line and enter a sell trade when the TSI crosses below the signal line. - **Divergences**: TSI can also be used to spot divergences between the indicator and price action, which can signal potential reversals.
The TSI is particularly useful in identifying the strength of a trend and the potential turning points, making it valuable for trend-following and swing trading strategies.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.
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.