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.
진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.