Quantitative Trading Strategy Based on Stochastics Momentum Index
This article introduces a quantitative trading strategy based on the Stochastics Momentum Index (SMI). The strategy utilizes the crossover signals between the SMI indicator and its exponential moving average (EMA) to…

Strategy Overview
This article introduces a quantitative trading strategy based on the Stochastics Momentum Index (SMI). The strategy utilizes the crossover signals between the SMI indicator and its exponential moving average (EMA) to identify potential buying and selling opportunities. When the SMI signal line crosses above its EMA, it triggers a buy signal; when the SMI signal line crosses below its EMA, it triggers a sell signal.
Strategy Principle
The core of this strategy is the Stochastics Momentum Index (SMI). SMI is a momentum oscillator that measures the closing price relative to the high-low range over a specified period. Specifically, the strategy first calculates the highest high and lowest low over the specified period, then computes the difference between the closing price and the midpoint of the high-low range, as well as the difference between the highest high and lowest low. Next, the strategy calculates the SMI value, which is the ratio of the average relative difference to the average absolute difference multiplied by 100. Finally, the strategy calculates the exponential moving average of SMI as the signal line.
When the SMI signal line crosses above its EMA, it indicates increasing upward momentum and triggers a buy signal; when the SMI signal line crosses below its EMA, it indicates increasing downward momentum and triggers a sell signal. Additionally, the strategy marks the overbought and oversold levels to identify extreme states of SMI.
Strategy Advantages
The strategy is based on the powerful momentum indicator SMI, which can effectively capture changes in market trends and momentum.
The strategy logic is clear and easy to understand and implement.
By using the exponential moving average as the signal line, the strategy can smooth price noise and improve signal reliability.
The marking of overbought and oversold levels provides additional risk management tools for the strategy.
Strategy Risks
The strategy relies on a single indicator, SMI, and may face the risk of indicator failure. To mitigate this risk, one can consider combining other technical indicators or fundamental factors to confirm trading signals.
The strategy may generate frequent trading signals in choppy markets, leading to high transaction costs. To address this issue, one can reduce trading frequency by optimizing parameters or introducing filtering mechanisms.
The strategy lacks an explicit stop-loss mechanism and may face the problem of excessive single-trade risk. This can be addressed by setting appropriate stop-loss levels to control risk.
Strategy Optimization Directions
Parameter Optimization: The performance of the strategy largely depends on the parameters used in the SMI calculation, such as %K length, %D length, etc. By optimizing these parameters, the performance of the strategy can be improved.
Signal Filtering: To reduce trading frequency and improve signal quality, additional filtering mechanisms such as trend confirmation and volume confirmation can be considered.
Risk Management: Incorporating explicit stop-loss and position management rules into the strategy can better control risk and enhance the robustness of the strategy.
Multi-Factor Combination: Combining SMI signals with other technical indicators or fundamental factors to form a more comprehensive and reliable trading decision mechanism.
Summary
This article introduces a quantitative trading strategy based on the Stochastics Momentum Index (SMI). The strategy utilizes the crossover signals between the SMI indicator and its exponential moving average to identify potential buying and selling opportunities. The advantages of the strategy lie in its basis on a powerful momentum indicator, clear logic, ease of implementation, and the use of moving averages and overbought/oversold levels to improve signal reliability and risk management. However, the strategy also faces risks such as single indicator failure, high-frequency trading, and insufficient risk control. To further enhance the performance of the strategy, optimization can be made in terms of parameter optimization, signal filtering, risk management, and multi-factor combination. Overall, the strategy provides a simple yet effective approach for quantitative trading, but it requires appropriate adjustments and optimizations based on specific circumstances in practical applications.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_int_1 | 10 | Percent K Length |
| v_input_int_2 | 3 | Percent D Length |
| v_input_int_3 | 40 | Overbought |
| v_input_int_4 | -40 | Oversold |
Source Pine Script
/*backtest
start: 2023-03-05 00:00:00
end: 2024-03-10 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Stochastics Momentum Index Strategy", shorttitle="SMI_BackTest", overlay=false)
// Input parameters
a = input.int(10, "Percent K Length")
b = input.int(3, "Percent D Length")
ob = input.int(40, "Overbought")
os = input.int(-40, "Oversold")
// Range Calculation
ll = ta.lowest(low, a)
hh = ta.highest(high, a)
diff = hh - ll
rdiff = close - (hh+ll)/2
avgrel = ta.ema(ta.ema(rdiff,b),b)
avgdiff = ta.ema(ta.ema(diff,b),b)
// SMI calculations
SMI = avgdiff != 0 ? (avgrel/(avgdiff/2)*100) : 0
SMIsignal = ta.ema(SMI,b)
emasignal = ta.ema(SMI, 10)
// Color Definition for Stochastic Line
col = SMI >= ob ? color.green : SMI <= os ? color.red : color.white
plot(SMIsignal, title="Stochastic", color=color.white)
plot(emasignal, title="EMA", color=color.yellow)
level_40 = ob
level_40smi = SMIsignal > level_40 ? SMIsignal : level_40
level_m40 = os
level_m40smi = SMIsignal < level_m40 ? SMIsignal : level_m40
plot(level_40, "Level ob", color=color.red)
plot(level_40smi, "Level ob SMI", color=color.red, style=plot.style_line)
plot(level_m40, "Level os", color=color.green)
plot(level_m40smi, "Level os SMI", color=color.green, style=plot.style_line)
//fill(level_40, level_40smi, color=color.red, transp=ob, title="OverSold")
//fill(level_m40, level_m40smi, color=color.green, transp=ob, title="OverBought")
// Strategy Tester
longCondition = ta.crossover(SMIsignal, emasignal)
if (longCondition)
strategy.entry("Buy", strategy.long)
shortCondition = ta.crossunder(SMIsignal, emasignal)
if (shortCondition)
strategy.entry("Sell", strategy.short)
Published by ChaoZhang on the FMZ strategy square · last modified 2024-03-11. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Quantitative-Trading-Strategy-Based-on-Stochastics-Momentum-Index.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- Advanced Multi Indicator Trend Following and Momentum Quantitative Trading StrategyPine Script · Momentum · 1h
- Ergotic Momentum Direction Convergence Trading StrategyPine Script · Momentum · 1d
- MoonFlag MACD Momentum StochRSI Trading StrategyPine Script · Momentum · 1d
- Multi EMA Trend Momentum Trading Strategy with Risk Management SystemPine Script · Momentum · 1h
- Multi factor Adaptive Momentum Tracking StrategyPine Script · Momentum · 3m
- Stochastic Momentum Index and RSI Based Quant Trading StrategyPine Script · Momentum · 5m