OPEN-SOURCE SCRIPT
SMI 30m With Built-in Divergence Alerts

Stochastic Momentum Index SMI 30m is a simplified, single-timeframe Stochastic Momentum Index (SMI) designed for traders who want a clean momentum oscillator with clear crossover signals and automatic higher-timeframe filtering.
This version is locked to a 30-minute timeframe, making it consistent across any chart you place it on.
The script plots:
SMI Blue Line – the main momentum line
SMI Orange Line – the signal line (EMA-smoothed)
Overbought / Oversold regions
Optional colored background zones that highlight strong momentum extremes
Both the Blue and Orange plots are fully exposed, allowing users to manually create TradingView alerts for crossovers.
Additionally, the script includes two built-in alert conditions for traders who prefer automatic signals.
How the SMI is calculated
This script uses a double-EMA smoothing method to stabilize momentum:
Highest and lowest price ranges are calculated over the selected %K period.
Relative position of price inside that range is computed.
A double EMA is applied to both the range and the midpoint offset.
The SMI result is scaled to ±200 for clarity.
The Signal Line is a single-EMA applied to the SMI.
These parameters can be adjusted:
%K Length
%D Length
EMA Length
The default values match traditional 13-3-3 SMI settings.
Visual Components
1. SMI Blue Line
Represents the primary momentum movement.
Values above 40 indicate positive momentum; values below −40 indicate negative momentum.
2. SMI Orange Line
Acts as a smoothing signal line.
Crossovers between Blue and Orange often indicate momentum shifts.
3. Overbought / Oversold Zones
+40 = overbought boundary
−40 = oversold boundary
These levels help identify exhaustion points.
4. Gradient High/Low Zones
The script includes colored fill zones above +40 and below −40 to visually highlight extreme momentum regions.
Built-In Alerts
The indicator includes two pre-configured alert conditions:
1. Bearish Cross (Overbought)
Triggers when:
The Blue SMI crosses below the Orange SMI
AND the Blue SMI value is above 80
This represents a potential bearish divergence or momentum reversal from extreme highs.
Alert title:
SMI Bearish Cross
2. Bullish Cross (Oversold)
Triggers when:
The Blue SMI crosses above the Orange SMI
AND the Blue SMI value is below −80
This represents a potential bullish divergence or reversal from extreme lows.
Alert title:
SMI Bullish Cross
How to Use Alerts
After adding the indicator to your chart:
Open the Alerts panel
Select Condition → SMI (1 TF) 30m
Choose either:
SMI Bearish Cross
SMI Bullish Cross
Set your preferred trigger method:
Once per bar close
Once per bar
Once per minute
Create the alert
Traders can also manually create alerts for:
Blue crossing above Orange
Blue crossing below Orange
Because both plots are fully exposed.
Purpose
This indicator is intended for traders who want a stable, single-timeframe SMI with:
Clear structure
Extreme-zone highlighting
Exposed plots for custom alerts
Built-in reversal alerts
Consistent 30-minute TF regardless of chart
It can be used for:
Identifying trend reversals
Detecting momentum exhaustion
Confirming entries/exits
Spotting early divergence signals
This version is locked to a 30-minute timeframe, making it consistent across any chart you place it on.
The script plots:
SMI Blue Line – the main momentum line
SMI Orange Line – the signal line (EMA-smoothed)
Overbought / Oversold regions
Optional colored background zones that highlight strong momentum extremes
Both the Blue and Orange plots are fully exposed, allowing users to manually create TradingView alerts for crossovers.
Additionally, the script includes two built-in alert conditions for traders who prefer automatic signals.
How the SMI is calculated
This script uses a double-EMA smoothing method to stabilize momentum:
Highest and lowest price ranges are calculated over the selected %K period.
Relative position of price inside that range is computed.
A double EMA is applied to both the range and the midpoint offset.
The SMI result is scaled to ±200 for clarity.
The Signal Line is a single-EMA applied to the SMI.
These parameters can be adjusted:
%K Length
%D Length
EMA Length
The default values match traditional 13-3-3 SMI settings.
Visual Components
1. SMI Blue Line
Represents the primary momentum movement.
Values above 40 indicate positive momentum; values below −40 indicate negative momentum.
2. SMI Orange Line
Acts as a smoothing signal line.
Crossovers between Blue and Orange often indicate momentum shifts.
3. Overbought / Oversold Zones
+40 = overbought boundary
−40 = oversold boundary
These levels help identify exhaustion points.
4. Gradient High/Low Zones
The script includes colored fill zones above +40 and below −40 to visually highlight extreme momentum regions.
Built-In Alerts
The indicator includes two pre-configured alert conditions:
1. Bearish Cross (Overbought)
Triggers when:
The Blue SMI crosses below the Orange SMI
AND the Blue SMI value is above 80
This represents a potential bearish divergence or momentum reversal from extreme highs.
Alert title:
SMI Bearish Cross
2. Bullish Cross (Oversold)
Triggers when:
The Blue SMI crosses above the Orange SMI
AND the Blue SMI value is below −80
This represents a potential bullish divergence or reversal from extreme lows.
Alert title:
SMI Bullish Cross
How to Use Alerts
After adding the indicator to your chart:
Open the Alerts panel
Select Condition → SMI (1 TF) 30m
Choose either:
SMI Bearish Cross
SMI Bullish Cross
Set your preferred trigger method:
Once per bar close
Once per bar
Once per minute
Create the alert
Traders can also manually create alerts for:
Blue crossing above Orange
Blue crossing below Orange
Because both plots are fully exposed.
Purpose
This indicator is intended for traders who want a stable, single-timeframe SMI with:
Clear structure
Extreme-zone highlighting
Exposed plots for custom alerts
Built-in reversal alerts
Consistent 30-minute TF regardless of chart
It can be used for:
Identifying trend reversals
Detecting momentum exhaustion
Confirming entries/exits
Spotting early divergence signals
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。