Short term Trading Strategy Based on Momentum Indicator
The strategy is named "Short-term Trading Strategy Based on Momentum Indicator". It utilizes the momentum indicator Mass Index to identify turning points in market trends and capture short-term trading opportunities.

Overview
The strategy is named "Short-term Trading Strategy Based on Momentum Indicator". It utilizes the momentum indicator Mass Index to identify turning points in market trends and capture short-term trading opportunities.
Strategy Logic
The strategy uses two exponential moving averages (EMA) with different parameters to smooth the difference between the highest and lowest prices and obtains the Mass Index indicator. It goes short when the Mass Index crosses above a threshold and goes long when crossing below a threshold.
Specifically, it first calculates the difference between the highest and lowest prices xPrice. Then it calculates the 9-period and 25-period EMA of xPrice, named xEMA and xSmoothXAvg respectively. After that, it sums the ratios of these two EMAs to get the Mass Index. When the Mass Index is greater than a threshold, it goes short. When less than a threshold, it goes long.
The strategy identifies trend reversal points by the crossover of Mass Index and thus conducts short-term trading. As market volatility intensifies, Mass Index will rise. As market volatility subsides, Mass Index will fall. Monitoring its breakthrough of certain level can effectively capture short-term trading opportunities.
Advantages
The strategy has the following advantages:
- Using momentum indicator Mass Index can effectively identify fluctuations and turning points in the short term
- Relatively accurate in positioning entry and exit points, avoiding chasing tops and bottoms
- Simple and clear trading strategy and parameters, easy to implement
- Flexible parameter adjustment for different market environments
Risks and Solutions
There are also some risks with this strategy:
- False breakouts may occur, resulting in unnecessary trades. Fine tuning parameters could reduce false signals.
- Long term trends are not considered, which may conflict with the main trend. Combine with trend indicators to avoid counter-trend trades.
- Curve fitting risk. Expand sample periods reasonably to test robustness of parameters.
Optimization Directions
The strategy can be optimized in the following aspects:
- Combine with fundamental analysis to avoid trading highly volatile low quality stocks
- Add stop loss mechanisms to strictly control single loss
- Combine with volatility indicators to reduce position sizing when market volatility rises
- Add conditional orders to optimize entry and exit timing
Conclusion
This strategy designs a simple short-term trading strategy based on the Mass Index indicator, which can effectively identify turning points in the market for precise long and short trades. The trading strategy and parameter settings are simple and intuitive, easy to implement, and adjustable for different market environments, making it highly practical. But risks of overfitting and failure of indicators should also be noticed. Trend analysis and stop loss should be combined to cope with market uncertainty.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 9 | Length1 |
| v_input_2 | 25 | Length2 |
| v_input_3 | 26.5 | Trigger |
| v_input_4 | false | Trade reverse |
Source Pine Script
/*backtest
start: 2023-02-20 00:00:00
end: 2024-02-26 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 12/09/2017
// The Mass Index was designed to identify trend reversals by measuring
// the narrowing and widening of the range between the high and low prices.
// As this range widens, the Mass Index increases; as the range narrows
// the Mass Index decreases.
// The Mass Index was developed by Donald Dorsey.
//
// You can change long to short in the Input Settings
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
strategy(title="MASS Index", shorttitle="MASS Index")
Length1 = input(9, minval=1)
Length2 = input(25, minval=1)
Trigger = input(26.5, step = 0.01)
reverse = input(false, title="Trade reverse")
hline(27, color=blue, linestyle=line, title = "Setup")
hline(Trigger, color=red, linestyle=line, title = "Trigger")
xPrice = high - low
xEMA = ema(xPrice, Length1)
xSmoothXAvg = ema(xEMA, Length1)
nRes = sum(iff(xSmoothXAvg != 0, xEMA / xSmoothXAvg, 0), Length2)
pos = iff(nRes > Trigger, -1,
iff(nRes < Trigger, 1, nz(pos[1], 0)))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1, 1, pos))
if (possig == 1)
strategy.entry("Long", strategy.long)
if (possig == -1)
strategy.entry("Short", strategy.short)
barcolor(possig == -1 ? red: possig == 1 ? green : blue )
plot(nRes, color=red, title="MASS Index")Published by ChaoZhang on the FMZ strategy square · last modified 2024-02-27. 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/Short-term-Trading-Strategy-Based-on-Momentum-Indicator.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
- ADX Momentum Trend StrategyPine Script · Momentum · 10m
- Advanced Multi Indicator Trend Following and Momentum Quantitative Trading StrategyPine Script · Momentum · 1h
- Bollinger Bands Momentum Trend Following Quantitative StrategyPine Script · Momentum · 1d
- Cross Period Momentum EMA Strategy with RSI and Dynamic ATR Stop LossPine Script · Momentum · 1d
- Dual EMA Crossover with RSI Momentum Enhanced Trading StrategyPine Script · Momentum · 1d
- Dual EMA Momentum Trend Trading Strategy with Full Body Candle Signal SystemPine Script · Momentum · 2h