Strategy vault / Mean reversion
Advanced Momentum EMA Trend Following with RSI Overbought Oversold Trading Strategy
This strategy is a trading system that combines trend following and momentum reversal. It primarily uses a 34-period EMA to determine the overall trend, RSI indicator to identify overbought/oversold areas, while…

Overview
This strategy is a trading system that combines trend following and momentum reversal. It primarily uses a 34-period EMA to determine the overall trend, RSI indicator to identify overbought/oversold areas, while incorporating candlestick patterns and volume confirmation. The strategy employs ATR-based dynamic stop-loss and take-profit levels, allowing for adaptive parameter adjustment based on market volatility.
Strategy Principles
The core logic includes the following key elements:
- Trend Determination: Uses 34-period EMA as the main trend indicator, only seeking long opportunities when price is above EMA
- Entry Conditions: Requires a consecutive "bearish-bullish-bullish" candlestick pattern
- Momentum Confirmation: Uses RSI indicator for momentum confirmation, requiring RSI value above 50 to confirm upward momentum
- Volume Filter: Requires current volume to be above 20-period average volume, ensuring sufficient market participation
- Risk Management: Uses 1.5x ATR for profit target and 1x ATR for stop-loss placement
Strategy Advantages
- Multiple Signal Confirmation: Combines trend, pattern, momentum, and volume dimensions for trade confirmation, effectively reducing false signals
- Dynamic Risk Management: ATR-based stop-loss and profit targets automatically adjust to market volatility
- Trend Following Characteristics: Ensures trading in the direction of the main trend through EMA, improving win rate
- Flexible Parameter Settings: Key parameters such as EMA period, RSI thresholds, ATR multipliers can be adjusted to adapt to different market conditions
Strategy Risks
- Trend Reversal Risk: May experience consecutive losses at trend turning points
- False Breakout Risk: Candlestick patterns may produce false breakouts leading to incorrect signals
- Market Volatility Risk: During periods of intense volatility, ATR values may abnormally expand, affecting stop-loss placement
- Parameter Sensitivity: Optimal parameters may vary significantly across different market environments
Strategy Optimization Directions
- Add Trend Strength Filter: Can introduce ADX indicator to measure trend strength, trading only in strong trends
- Improve Exit Mechanism: Can add trailing stops to protect existing profits
- Optimize Volume Indicator: Consider using relative volume or volume breakout indicators
- Add Time Filters: Can incorporate trading time windows to avoid highly volatile periods
- Introduce Market Environment Classification: Dynamically adjust strategy parameters based on different market conditions
Summary
The strategy builds a complete trading system by combining multiple technical indicators, offering good adaptability and scalability. Its core advantages lie in multi-dimensional signal confirmation and dynamic risk management, while attention needs to be paid to parameter optimization and market environment adaptability. Through continuous optimization and improvement, the strategy has the potential to maintain stable performance across different market conditions.
Source Pine Script
/*backtest
start: 2024-08-01 00:00:00
end: 2025-02-18 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © bommytarton
//@version=6
strategy("Improved Momentum and Pivot Reversal Strategy", overlay=true)
// Define user inputs
lengthEMA = input.int(34, title="EMA Length", minval=1)
lengthRSI = input.int(14, title="RSI Length", minval=1)
rsiOverbought = input.int(70, title="RSI Overbought Level", minval=50, maxval=100)
rsiOversold = input.int(30, title="RSI Oversold Level", minval=0, maxval=50)
lengthATR = input.int(14, title="ATR Length", minval=1)
multATR = input.float(1.5, title="ATR Multiplier for Take-Profit", minval=1.0)
stopLossMultiplier = input.float(1.0, title="Stop Loss Multiplier for ATR", minval=0.5, maxval=3.0) // Adjust the stop-loss to be tighter or wider
// Calculate the indicators
ema34 = ta.ema(close, lengthEMA)
rsiValue = ta.rsi(close, lengthRSI)
atrValue = ta.atr(lengthATR)
// Define entry conditions
longCondition = close > ema34 and close[1] < open[1] and close > open and close[2] > open[2] and close[1] < open[1] and rsiValue > 50
// Define stop-loss and take-profit based on ATR
stopLoss = close - (atrValue * stopLossMultiplier) // Tighter stop-loss using the ATR multiplier
takeProfit = close + (atrValue * multATR) // Take profit with adjustable multiplier
// Volume condition filter (make sure that the volume is higher than average over the past 20 bars)
avgVolume = ta.sma(volume, 20)
volumeCondition = volume > avgVolume
// Only trigger long if all conditions are met (trend above 34 EMA, red-green-green candle pattern, volume confirmation)
if (longCondition and volumeCondition)
strategy.entry("Long", strategy.long, stop=stopLoss, limit=takeProfit)
// Exit conditions based on RSI overbought/oversold and trailing stop
exitCondition = rsiValue > rsiOverbought or close < stopLoss
// Execute the exit strategy when RSI is overbought or price hits the stop-loss level
if (exitCondition)
strategy.close("Long") // Close the position when exit condition is met
// Plotting for visualization
plot(ema34, title="34 EMA", color=color.blue)
plot(stopLoss, title="Stop Loss", color=color.red, linewidth=2)
plot(takeProfit, title="Take Profit", color=color.green, linewidth=2)
Published by ianzeng123 on the FMZ strategy square · last modified 2025-02-20. 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/Advanced-Momentum-EMA-Trend-Following-with-RSI-Overbought-Oversold-Trading-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
- Dynamic Adaptive Multi Timeframe Trend Following and Range Reversal Hybrid StrategyPine Script · Mean reversion · 2d
- Multi Indicator Reversal Point Capture Trading StrategyPine Script · Mean reversion · 1d
- Oma and Apollo Dual Rail Trading StrategyPine Script · Mean reversion · 5m
- Reversal Trading Strategy with Bollinger Bands RSI ADX and ATRPine Script · Mean reversion · 1h
- Trend Reversal Momentum Indicators Crossover Tracking StrategyPine Script · Mean reversion · 1h
- Bollinger Bands Trend Reversal StrategyPine Script · Mean reversion · 10m