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
Skrip sumber terbuka
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Penafian
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.
Skrip sumber terbuka
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Penafian
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.