Cross Period Momentum EMA Strategy with RSI and Dynamic ATR Stop Loss
This strategy is a comprehensive intraday trading system that combines multiple technical indicators. It primarily uses the crossover signals of fast and slow Exponential Moving Averages (EMA) as the main entry…

Overview
This strategy is a comprehensive intraday trading system that combines multiple technical indicators. It primarily uses the crossover signals of fast and slow Exponential Moving Averages (EMA) as the main entry criteria, incorporates the Relative Strength Index (RSI) for momentum filtering, and utilizes the Average True Range (ATR) for dynamic stop-loss placement, forming a complete trading system. Through strict risk control and dynamic profit/loss settings, the strategy aims to capture short-term market fluctuations.
Strategy Principles
The core logic includes the following aspects:
- Trend Determination: Using 9-period and 21-period EMA crossovers to identify market trend direction
- Momentum Filtering: Employing 14-period RSI for overbought/oversold judgments to prevent counter-trend entries
- Risk Control: Setting dynamic stop-loss levels based on 14-period ATR with a multiplier of 1.5
- Profit Targets: Setting dynamic take-profit levels at 2 times ATR from entry point
Specific trading rules:
- Long Entry: Fast EMA crosses above Slow EMA with RSI below 70
- Short Entry: Fast EMA crosses below Slow EMA with RSI above 30
- Stop-Loss: Long positions set at 1.5 times ATR below entry, short positions at 1.5 times ATR above entry
- Take-Profit: Dynamic levels set at 2 times ATR from entry price
Strategy Advantages
- Multiple Indicator Confirmation: Combines trend and momentum indicators for improved signal reliability
- Dynamic Risk Management: Adapts stop-loss levels to market volatility using ATR
- Systematic Trading: Clear entry and exit conditions reduce subjective judgment
- Reasonable Risk-Reward Ratio: Balanced profit and loss settings for long-term stability
- High Adaptability: Parameters can be adjusted for different market characteristics
Strategy Risks
- Rapid Oscillation Risk: May generate frequent false breakout signals in ranging markets
- Slippage Impact: Intraday trading requires high execution efficiency
- Parameter Sensitivity: Optimal parameters may vary across different market environments
- Transaction Costs: Frequent trading may incur higher costs
Risk Control Suggestions:
- Conduct thorough historical data backtesting
- Consider adding trading filters
- Control position sizing appropriately
- Regular parameter effectiveness evaluation
Strategy Optimization Directions
- Enhanced Market Environment Filtering:
- Add volatility indicators to judge market characteristics
- Dynamically adjust parameters based on market conditions
- Refined Trading Rules:
- Consider adding time filters
- Implement volume confirmation mechanisms
- Optimize profit/loss ratios
- Strengthened Risk Control:
- Implement dynamic position sizing
- Add maximum drawdown controls
- Design comprehensive money management plans
Summary
This strategy constructs a relatively complete trading system by combining EMA trend following, RSI momentum filtering, and ATR dynamic risk control. Its main feature is the synergistic effect of multiple technical indicators while emphasizing risk management. While there is room for optimization, the overall design philosophy aligns with systematic quantitative trading principles. Traders are advised to conduct thorough parameter optimization and backtesting before live implementation, while making appropriate adjustments based on their risk tolerance and money management requirements.
Source Pine Script
/*backtest
start: 2024-02-10 00:00:00
end: 2025-02-08 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Day Trading EMA/RSI Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=200)
// Ulazni parametri
fastEmaPeriod = input.int(9, "Fast EMA Period", minval=1)
slowEmaPeriod = input.int(21, "Slow EMA Period", minval=1)
rsiPeriod = input.int(14, "RSI Period", minval=1)
rsiOversold = input.int(30, "RSI Oversold Level")
rsiOverbought = input.int(70, "RSI Overbought Level")
atrPeriod = input.int(14, "ATR Period", minval=1)
atrMultiplier = input.float(1.5, "ATR Multiplier za Stop Loss", step=0.1)
takeProfitFactor= input.float(2.0, "Take Profit Factor", step=0.1)
// Izračun indikatora
fastEMA = ta.ema(close, fastEmaPeriod)
slowEMA = ta.ema(close, slowEmaPeriod)
rsiValue = ta.rsi(close, rsiPeriod)
atrValue = ta.atr(atrPeriod)
// Definicija trenda: ako je fastEMA iznad slowEMA, smatramo da je trend uzlazan, inače silazni.
trendUp = fastEMA > slowEMA
trendDown = fastEMA < slowEMA
// Uvjeti za ulaz:
// Ulaz u long poziciju: crossover fastEMA i slowEMA, uz filtriranje da RSI nije prekupovan (manje od rsiOverbought)
longCondition = ta.crossover(fastEMA, slowEMA) and (rsiValue < rsiOverbought)
// Ulaz u short poziciju: crossunder fastEMA i slowEMA, uz filtriranje da RSI nije preprodavan (više od rsiOversold)
shortCondition = ta.crossunder(fastEMA, slowEMA) and (rsiValue > rsiOversold)
// Definicija dinamičnih stop-loss razina (ATR-based)
stopLossLong = close - (atrMultiplier * atrValue)
stopLossShort = close + (atrMultiplier * atrValue)
// Izvršenje naloga
if (longCondition)
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", "Long", stop=stopLossLong, limit=close + (takeProfitFactor * atrValue))
if (shortCondition)
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", "Short", stop=stopLossShort, limit=close - (takeProfitFactor * atrValue))
// Plotanje indikatora za preglednost
plot(fastEMA, title="Fast EMA", color=color.green)
plot(slowEMA, title="Slow EMA", color=color.red)
Published by ChaoZhang on the FMZ strategy square · last modified 2025-02-10. 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/Cross-Period-Momentum-EMA-Strategy-with-RSI-and-Dynamic-ATR-Stop-Loss.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 EMA Trend Momentum Trading Strategy with Risk Management SystemPine Script · Momentum · 1h
- Multi Indicator Trend Momentum Trading Strategy with Dynamic Risk Management SystemPine Script · Momentum · 1h
- Multi Technical Indicator Based Trend Following and Momentum StrategyPine Script · Momentum · 1d
- Multi Trend Momentum Crossover Strategy with Volatility Optimization SystemPine Script · Momentum · 1d
- Multi Period EMA Crossover with RSI Momentum and ATR Volatility Based Trend Following StrategyPine Script · Momentum · 3h