Strategy vault / Trend following
Dynamic Moving Average Trend Following Strategy with RSI ADX Composite Indicators
This strategy is a trend following system based on the 200-period Simple Moving Average (MA200), combined with technical indicators including the Relative Strength Index (RSI), Average Directional Index (ADX), and…

Overview
This strategy is a trend following system based on the 200-period Simple Moving Average (MA200), combined with technical indicators including the Relative Strength Index (RSI), Average Directional Index (ADX), and Average True Range (ATR) to form a complete trading decision framework. The strategy implements effective risk control through dynamic stop-loss and profit targets. Backtesting results show that the strategy has achieved good win rates across multiple trading instruments, demonstrating strong adaptability and stability.
Strategy Principles
The core logic of the strategy is built on the following key points:
- Uses MA200 as the primary trend indicator, generating initial signals when price breaks through MA200
- Employs RSI for overbought/oversold judgment, requiring RSI>40 for buy signals and RSI<60 for sell signals
- Incorporates ADX to judge trend strength, requiring ADX>20 to ensure clear trends
- Filters false breakouts through 2-period signal confirmation
- Sets dynamic stop-loss based on ATR, with fixed take profit at 2%
Strategy Advantages
- Multiple indicator collaboration validates signals, improving reliability
- Dynamic stop-loss design effectively controls risk
- Signal delay confirmation mechanism reduces false breakout impacts
- Clear strategy logic with reasonable parameter settings, highly practical
- Backtesting shows maintained high win rates across multiple trading instruments
Strategy Risks
- Long MA200 period may lead to delayed entry timing
- Fixed 2% profit target might exit too early in strong trends
- RSI and ADX parameters may need optimization for different market characteristics
- Signal confirmation mechanism might miss trading opportunities in fast markets
Strategy Optimization Directions
- Consider introducing adaptive moving average periods
- Design dynamic profit target calculation methods
- Add volume indicators as auxiliary judgment
- Optimize dynamic adjustment mechanism for signal confirmation periods
- Introduce volatility filters to adjust position sizing during high volatility periods
Summary
The strategy builds a robust trend following system by combining multiple technical indicators. The design emphasizes risk control through dynamic stop-loss and signal confirmation mechanisms to improve trading reliability. While there is room for optimization, it is overall a practical trading strategy with real value. Future improvements can be made through parameter optimization and additional auxiliary indicators to further enhance strategy performance.
Source Pine Script
/*backtest
start: 2024-02-21 00:00:00
end: 2025-02-18 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"TRB_USDT"}]
*/
//@version=5
strategy("BTC/USD MA200 with RSI, ADX, ATR", overlay=true)
// Definition of the main moving average
ma_trend = ta.sma(close, 200) // Main trend filter
// Definition of RSI and ADX
rsi = ta.rsi(close, 14)
[diplus, diminus, adx] = ta.dmi(14, 14) // Correction for ADX
// Definition of ATR for Stop Loss and Take Profit
atr = ta.atr(14)
// Conditions for crossing of the MA200
crossover_condition = ta.crossover(close, ma_trend)
crossunder_condition = ta.crossunder(close, ma_trend)
// Trend confirmation after 2 bars
buy_confirmation = crossover_condition[2] and (rsi > 40) and (adx > 20) and close > ma_trend
sell_confirmation = crossunder_condition[2] and (rsi < 60) and (adx > 20) and close < ma_trend
// Definition of Stop Loss and Take Profit
take_profit = close * 1.02 // 2% profit
stop_loss = close - (1.5 * atr) // Dynamic stop based on ATR
// Execution of orders
if (buy_confirmation and strategy.opentrades == 0)
strategy.entry("Buy", strategy.long)
strategy.exit("Take Profit/Stop Loss", from_entry="Buy", limit=take_profit, stop=stop_loss)
label.new(bar_index, high, "BUY", style=label.style_label_down, color=color.green, textcolor=color.white, size=size.normal)
if (sell_confirmation)
if (strategy.opentrades > 0)
strategy.close("Buy")
label.new(bar_index, low, "SELL", style=label.style_label_up, color=color.red, textcolor=color.white, size=size.normal)
// Draw the main moving average
plot(ma_trend, color=color.purple, title="MA 200")
Published by ianzeng123 on the FMZ strategy square · last modified 2025-02-27. 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-Moving-Average-Trend-Following-Strategy-with-RSI-ADX-Composite-Indicators.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 Dimensional Short Term Trend Predictor Technical Analysis and Volatility Adaptive Trading StrategyPine Script · Trend following · 1h
- Multi Indicator Trend Following with Oscillator Alert StrategyPine Script · Trend following · 2h
- Trend Tracking and Short term Trading Strategy Based on ADX IndicatorPine Script · Trend following · 1d
- Advanced Quantitative Trading Strategy Multi Dimensional Super Trend ATR Dynamic Tracking SystemPine Script · Trend following · 1h
- Multi Period Trend Confirmation Dynamic Risk Control Quantitative Trading StrategyPine Script · Trend following · 1h
- Adaptive Dual Strategy System for Trend Following and Range TradingPine Script · Trend following · 1h