Momentum Stacking Strategy of Different Timeframes
The Momentum Stacking Strategy mainly calculates the Rate of Change (ROC) over different periods, weights and stacks them to form a comprehensive momentum indicator for judging the trend direction. This strategy…

Overview
The Momentum Stacking Strategy mainly calculates the Rate of Change (ROC) over different periods, weights and stacks them to form a comprehensive momentum indicator for judging the trend direction. This strategy stacks short-term, intermediate-term and long-term momentum indicators to balance short-term and long-term trends and avoid false signals.
Strategy Logic
The strategy first calculates the ROC indicators over 10-day, 15-day, 20-day periods, etc. Then smooths the ROC and stacks them in a 1-4 weighted ratio to get the formula:
roc1 = (sma(roc(close,10),10)*1)
roc2 = (sma(roc(close,15),10)*2)
...
osc = roc1+roc2+roc3+roc4+...
Where roc1-roc12 represent ROC calculations over different periods from 10-day to 530-day.
It then smoothes osc by a SMA of a (default 10) days to get oscsmt.
Compares osc with oscsmt, when osc crosses over oscsmt as the bullish signal and enters long. When osc crosses below oscsmt as the bearish signal and enters short.
Finally, it can choose to reverse the trading direction.
Advantages
Stacking short-term and long-term momentum indicators can capture both short-term and long-term trends, avoiding false signals.
Comparing osc and oscsmt can reduce unnecessary trading in sideways markets.
Customizable parameters to adjust ROC periods and SMA smoothness.
Reversible trading direction caters to different trading styles.
Visual indicators make buying and selling points intuitive.
Risks and Optimizations
ROC is very sensitive to sudden price abnormalities, which may generate wrong signals. Can increase the SMA smoothness to lower ROC sensitivity.
Default parameters may not suit all trading instruments. Need optimization to find the best parameter combination based on different characteristics.
Trades only based on osc and oscsmt crossover. Can add other indicators to filter signals and reduce errors.
More suitable for medium-long term trading. May need to adjust ROC periods to optimize usage scenario.
Conclusion
The Momentum Stacking Strategy calculates multiple ROC periods to get a comprehensive momentum indicator, capturing both short-term and long-term trends, avoiding false signals. Compared to a single ROC, it greatly improves signal quality and reliability. But it still carries some monitoring risks. Parameters need optimization and combining other indicators to maximize usefulness.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 10 | Smooth |
| v_input_2_close | 0 | Source: close | high | low | open | hl2 | hlc3 | hlcc4 | ohlc4 |
| v_input_3 | false | Trade reverse |
Source Pine Script
/*backtest
start: 2023-09-25 00:00:00
end: 2023-10-25 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
////////////////////////////////////////////////////////////
// Copyright by HPotter 08/08/2017
// Pring's Special K is a cyclical indicator created by Martin Pring.
// His method combines short-term, intermediate and long-term velocity
// into one complete series. Useful tool for Long Term Investors
// Modified for any source.
//
// You can change long to short in the Input Settings
// Please, use it only for learning or paper trading. Do not for real trading.
////////////////////////////////////////////////////////////
strategy(title="Martin Pring's Special K Backtest", shorttitle="UCS_Pring_sK")
a = input(10, title = "Smooth" )
sources = input(title="Source", defval=close)
reverse = input(false, title="Trade reverse")
roc1 = (sma(roc(sources,10),10)*1)
roc2 = (sma(roc(sources,15),10)*2)
roc3 = (sma(roc(sources,20),10)*3)
roc4 = (sma(roc(sources,30),15)*4)
roc5 = (sma(roc(sources,40),50)*1)
roc6 = (sma(roc(sources,65),65)*2)
roc7 = (sma(roc(sources,75),75)*3)
roc8 = (sma(roc(sources,100),100)*4)
roc9 = (sma(roc(sources,195),130)*1)
roc10 = (sma(roc(sources,265),130)*2)
roc11 = (sma(roc(sources,390),130)*3)
roc12 = (sma(roc(sources,530),195)*4)
osc = roc1+roc2+roc3+roc4+roc5+roc6+roc7+roc8+roc9+roc10+roc11+roc12
oscsmt = sma(osc,a)
pos = iff(osc > oscsmt, 1,
iff(osc < oscsmt, -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(osc, color=blue, title="Martin Pring's Special K")
plot(oscsmt, color = red, title = "Smooth")
hline(0, title="Zero Line")Published by ChaoZhang on the FMZ strategy square · last modified 2023-10-26. 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/Momentum-Stacking-Strategy-of-Different-Timeframes.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
- Adaptive Trend Following Strategy Based on Momentum OscillatorPine Script · Momentum · 1d
- Bollinger Bands Momentum Trend Following Quantitative StrategyPine Script · Momentum · 1d
- Confirmed SMA Crossover Momentum StrategyPine Script · Momentum · 1d
- Cross Momentum Trend Following Strategy SMA RSI Cross Momentum SystemPine Script · Momentum · 1h
- Dual Moving Average Momentum Trading Strategy Time Optimized Trend Following SystemPine Script · Momentum · 2m