OPEN-SOURCE SCRIPT

True Strength Index with Buy/Sell Signals and Alerts

Por LuxmiAI
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.
Moving AveragesOscillatorssentiment
LuxmiAI

Script de código abierto

Siguiendo fielmente el espíritu de TradingView, el autor de este script lo ha publicado en código abierto, permitiendo que otros traders puedan entenderlo y verificarlo. ¡Olé por el autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la reutilización de este código en la publicación se rige por las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

¿Quiere utilizar este script en un gráfico?

Exención de responsabilidad