OPEN-SOURCE SCRIPT

Smart Money Index + True Strength Index

The Smart Money Index + True Strength Index indicator is a combination of two popular technical analysis indicators: the Smart Money Index (SMI) and the True Strength Index (TSI). This combined indicator helps traders identify potential entry points for long and short positions based on signals from both indexes.

Main Components:
Smart Money Index (SMI):
The SMI measures the difference between the closing and opening price of a candle multiplied by the trading volume over a certain period of time. This allows you to assess the activity of large players ("smart money") in the market. If the SMI value is above a certain threshold (smiThreshold), it may indicate a bullish trend, and if lower, it may indicate a bearish trend.

True Strength Index (TSI):
The TSI is an oscillator that measures the strength of a trend by comparing the price change of the current bar with the previous bar. It uses two exponential moving averages (EMAS) to smooth the data. TSI values can fluctuate around zero, with values above the overbought level indicating a possible downward correction, and values below the oversold level signaling a possible upward correction.

Parameters:
SMI Length: Defines the number of candles used to calculate the average SMI value. The default value is 14.
SMI Threshold: A threshold value that is used to determine a buy or sell signal. The default value is 0.
Length of the first TSI smoothing (tsiLength1): The length of the first EMA for calculating TSI. The default value is 25.
Second TSI smoothing length (tsiLength2): The length of the second EMA for additional smoothing of TSI values. The default value is 13.
TSI Overbought level: The level at which the market is considered to be overbought. The default value is 25.
Oversold level TSI: The level at which it is considered that the market is in an oversold state. The default value is -25.
Logic of operation:
SMI calculation:
First, the difference between the closing and opening price of each candle (close - open) is calculated.
This difference is then multiplied by the trading volume.
The resulting product is averaged using a simple moving average (SMA) over a specified period (smiLength).
Calculation of TSI:
The price change relative to the previous bar is calculated (close - close[1]).
The first EMA with the length tsiLength1 is applied.
Next, a second EMA with a length of tsiLength2 is applied to obtain the final TSI value.
The absolute value of price changes is calculated in the same way, and two emas are also applied.
The final TSI index is calculated as the ratio of these two values multiplied by 100.
Graphical representation:
The SMI and TSI lines are plotted on the graph along with their respective thresholds.
For SMI, the line is drawn in orange, and the threshold level is dotted in gray.
For the TSI, the line is plotted in blue, the overbought and oversold levels are indicated by red and green dotted lines, respectively.
Conditions for buy/sell signals:
A buy (long) signal is generated when:
SMI is greater than the threshold (smi > smiThreshold)
TSI crosses the oversold level from bottom to top (ta.crossover(tsi, oversold)).
A sell (short) signal is generated when:
SMI is less than the threshold (smi < smiThreshold)
TSI crosses the overbought level from top to bottom (ta.crossunder(tsi, overbought)).
Signal display:
When the conditions for a long or short are met, labels labeled "LONG" or "SHORT" appear on the chart.
The label for the long is located under the candle and is colored green, and for the short it is above the candle and is colored red.
Notification generation:
The indicator also supports notifications via the TradingView platform. Notifications are sent when conditions arise for a long or short position.
This combined indicator provides the trader with the opportunity to use both SMI and TSI signals simultaneously, which can improve the accuracy of trading decisions.



https://www.tradingview.com/x/BWgQLyWl/anlık görüntü

Feragatname