Dynamic Momentum Strategy
The strategy calculates and plots the 14-day simple moving average (SMA) and 28-day SMA. It goes long when the two lines have a golden cross and goes short when there is a death cross, in order to capture changes in…

Overview
The strategy calculates and plots the 14-day simple moving average (SMA) and 28-day SMA. It goes long when the two lines have a golden cross and goes short when there is a death cross, in order to capture changes in market momentum.
Strategy Logic
The core indicators of this strategy are the 14-day SMA and 28-day SMA. The 14-day SMA responds quickly to price changes, reflecting short-term trends. The 28-day SMA is more stable, reflecting medium-term trends. When the shorter SMA crosses over the longer SMA, it indicates the short-term trend is stronger than the long-term trend. Going long can capture the upside momentum. When the shorter SMA crosses below the longer SMA, it indicates the long-term trend is weakening. Going short can capture the downside momentum.
Using SMA crosses to determine long/short positions is a common trading signal. Compared to a single SMA indicator, the dual SMA cross combines information from different time horizons and avoids false signals.
Advantage Analysis
The advantages of this strategy include:
- Simple to implement and operate.
- Quickly responds to price changes and catches market turns.
- Combines short-term and medium-term information for relatively reliable signals.
- SMA parameters can be adjusted to adapt to different markets.
Risk Analysis
There are also some risks:
- SMA itself has lagging effect, signals may be delayed.
- Cannot handle extreme market volatility like flash crashes.
- More SMA crosses increase trading frequency and costs.
- Simple entry/exit rules have room for optimization.
Risk management measures include: allowing wider stops, emphasizing risk control; adjusting SMA periods based on market; combining other filters.
Optimization Directions
The strategy can be improved in areas like:
- Add filters to avoid false crosses. Confirm with volume, Stochastic etc.
- Add stop loss mechanisms. Such as ATR stops, breakout stops.
- Optimize SMA periods. Such as adaptive SMA, ML parameter selection.
- Combine with other strategy types. Such as drawdown control, trend following to make combo strategies.
Conclusion
The momentum SMA cross strategy dynamically captures changing market trends by calculating dual SMA cross signals. It is easy to implement and responds quickly, but also has lagging risk. Future improvements can be made in confirming signals, stop losses, parameter selection etc, or combine with other strategies for better results.
Source Pine Script
/*backtest
start: 2023-11-06 00:00:00
end: 2023-12-06 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Tu Estrategia", overlay=true)
// Variables de estrategia
var bool longCondition = na
var bool shortCondition = na
// Indicador
emaValue = ta.ema(close, 30)
plotColor = close > open ? color.green : color.red
plot(emaValue, color=plotColor, linewidth=2)
value = 10 * open / close
plotColor2 = close == open ? color.orange : color.blue
plot(value, color=plotColor2, linewidth=2)
// Lógica de la estrategia
longCondition := ta.crossover(ta.sma(close, 14), ta.sma(close, 28))
shortCondition := ta.crossunder(ta.sma(close, 14), ta.sma(close, 28))
// Entradas de estrategia
if (longCondition)
strategy.entry("Long", strategy.long)
if (shortCondition)
strategy.entry("Short", strategy.short)
plotColor3 = strategy.position_size > 0 ? color.green :
strategy.position_size < 0 ? color.red :
color.yellow
plot(ta.sma(close, 10), color=plotColor3)
Published by ChaoZhang on the FMZ strategy square · last modified 2023-12-07. 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/Dynamic-Momentum-Strategy.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
- Multi EMA Trend Momentum Trading Strategy with Risk Management SystemPine Script · Momentum · 1h
- Momentum Trading Strategy Based on Multi factor ModelPine Script · Momentum · 1d
- Multi Indicator Comprehensive Analysis Quantitative Trading Strategy Trend Momentum and Volatility Collaborative Prediction ModelPine Script · Momentum · 3m
- Oscillator Candles Momentum Trading StrategyPine Script · Momentum · 1h
- Dual EMA Stochastic Oscillator System A Quantitative Trading Model Combining Trend Following and MomentumPine Script · Momentum · 1h
- Advanced Multi Indicator Trend Following and Momentum Quantitative Trading StrategyPine Script · Momentum · 1h