Multi EMA Trend Momentum Trading Strategy with Risk Management System
This is a trading strategy that combines momentum and trend, using multiple Exponential Moving Averages (EMAs), Relative Strength Index (RSI), and Stochastic oscillator to identify market trends and momentum. The…

Overview
This is a trading strategy that combines momentum and trend, using multiple Exponential Moving Averages (EMAs), Relative Strength Index (RSI), and Stochastic oscillator to identify market trends and momentum. The strategy incorporates a risk management system based on Average True Range (ATR), including dynamic stop-loss, profit targets, and trailing stops, along with risk-based position sizing.
Strategy Principles
The strategy employs 5 EMAs with different periods (8, 13, 21, 34, 55) to determine trend direction. An uptrend is identified when shorter-period EMAs are above longer-period EMAs, and vice versa for downtrends. RSI confirms momentum with different entry and exit thresholds. The Stochastic oscillator serves as a third filter to avoid overbought and oversold conditions. The risk management system uses ATR to set dynamic stop-loss (2x ATR) and profit targets (4x ATR), with a 1.5x ATR trailing stop to protect profits. Position sizing is calculated based on 1% risk of account equity.
Strategy Advantages
- Multiple confirmation mechanism: Combines trend and momentum indicators to reduce false signals
- Dynamic risk management: Adapts stop-loss and profit targets based on market volatility
- Intelligent position sizing: Automatically adjusts trade size based on risk and volatility
- Complete profit protection: Uses trailing stops to lock in profits
- Flexible exit mechanism: Multiple conditions ensure timely exits
- Low risk exposure: Limits losses to 1% of account per trade
Strategy Risks
- Choppy market risk: Multiple EMA system may generate frequent false signals in ranging markets
- Slippage risk: High volatility periods may lead to execution prices deviating from expected levels
- Money management risk: Despite single trade loss limits, consecutive losses can significantly impact capital
- Parameter optimization risk: Over-optimization may lead to overfitting
- Technical indicator lag: Both moving averages and oscillators have inherent lag
Strategy Optimization Directions
- Market environment filtering: Add volatility filters to adjust strategy parameters during high volatility periods
- Time filtering: Adjust trading parameters based on different time period characteristics
- Dynamic parameter adjustment: Automatically adjust EMA periods and indicator thresholds based on market conditions
- Add volume confirmation: Incorporate volume analysis to improve signal reliability
- Optimize exit mechanism: Research optimal trailing stop multipliers
- Introduce machine learning: Use machine learning to optimize parameter selection
Summary
The strategy provides a comprehensive trading solution by combining multiple technical indicators with a robust risk management system. Its core strengths lie in its multi-layer filtering mechanism and dynamic risk management, but it still requires optimization based on specific market characteristics. Successful implementation requires continuous monitoring and adjustment, especially parameter adaptability in different market environments. Through the proposed optimization directions, the strategy has the potential to further improve its stability and profitability.
Source Pine Script
/*backtest
start: 2024-11-04 00:00:00
end: 2024-12-04 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Combined Strategy (Modernized)", overlay = true)
//----------//
// MOMENTUM //
//----------//
ema8 = ta.ema(close, 8)
ema13 = ta.ema(close, 13)
ema21 = ta.ema(close, 21)
ema34 = ta.ema(close, 34)
ema55 = ta.ema(close, 55)
// Plotting EMAs for visualization
plot(ema8, color=color.red, title="EMA 8", linewidth=1)
plot(ema13, color=color.orange, title="EMA 13", linewidth=1)
plot(ema21, color=color.yellow, title="EMA 21", linewidth=1)
plot(ema34, color=color.aqua, title="EMA 34", linewidth=1)
plot(ema55, color=color.lime, title="EMA 55", linewidth=1)
longEmaCondition = ema8 > ema13 and ema13 > ema21 and ema21 > ema34 and ema34 > ema55
exitLongEmaCondition = ema13 < ema55
shortEmaCondition = ema8 < ema13 and ema13 < ema21 and ema21 < ema34 and ema34 < ema55
exitShortEmaCondition = ema13 > ema55
// ---------- //
// OSCILLATORS //
// ----------- //
rsi = ta.rsi(close, 14)
longRsiCondition = rsi < 70 and rsi > 40
exitLongRsiCondition = rsi > 70
shortRsiCondition = rsi > 30 and rsi < 60
exitShortRsiCondition = rsi < 30
// Stochastic
k = ta.stoch(close, high, low, 14)
d = ta.sma(k, 3)
longStochasticCondition = k < 80
exitLongStochasticCondition = k > 95
shortStochasticCondition = k > 20
exitShortStochasticCondition = k < 5
//----------//
// STRATEGY //
//----------//
// ATR for dynamic stop loss and take profit
atr = ta.atr(14)
stopLossMultiplier = 2
takeProfitMultiplier = 4
stopLoss = atr * stopLossMultiplier
takeProfit = atr * takeProfitMultiplier
// Trailing stop settings
trailStopMultiplier = 1.5
trailOffset = atr * trailStopMultiplier
// Risk management: dynamic position sizing
riskPerTrade = 0.01 // 1% risk per trade
positionSize = strategy.equity * riskPerTrade / stopLoss
longCondition = longEmaCondition and longRsiCondition and longStochasticCondition and strategy.position_size == 0
exitLongCondition = (exitLongEmaCondition or exitLongRsiCondition or exitLongStochasticCondition) and strategy.position_size > 0
if (longCondition)
strategy.entry("LONG", strategy.long, qty=positionSize)
strategy.exit("Take Profit Long", "LONG", stop=close - stopLoss, limit=close + takeProfit, trail_offset=trailOffset)
if (exitLongCondition)
strategy.close("LONG")
shortCondition = shortEmaCondition and shortRsiCondition and shortStochasticCondition and strategy.position_size == 0
exitShortCondition = (exitShortEmaCondition or exitShortRsiCondition or exitShortStochasticCondition) and strategy.position_size < 0
if (shortCondition)
strategy.entry("SHORT", strategy.short, qty=positionSize)
strategy.exit("Take Profit Short", "SHORT", stop=close + stopLoss, limit=close - takeProfit, trail_offset=trailOffset)
if (exitShortCondition)
strategy.close("SHORT")
Published by ChaoZhang on the FMZ strategy square · last modified 2024-12-05. 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/Multi-EMA-Trend-Momentum-Trading-Strategy-with-Risk-Management-System.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
- KST EMA Momentum Trend Following StrategyPine Script · Momentum · 1d
- Multi Indicator Trend Momentum Trading Strategy with Dynamic Risk Management SystemPine Script · Momentum · 1h
- Multi Trend Momentum Crossover Strategy with Volatility Optimization SystemPine Script · Momentum · 1d
- 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
- Polynomial Interpolation Based RSI Momentum StrategyPine Script · Momentum · 1h