Strategy vault / Mean reversion
RSI Tracking ADX Strategy
The RSI Tracking ADX strategy is a trend following strategy that combines the RSI indicator and the ADX indicator. It uses the RSI indicator to determine overbought and oversold conditions, and the ADX indicator to…
Summary
The RSI Tracking ADX strategy is a trend following strategy that combines the RSI indicator and the ADX indicator. It uses the RSI indicator to determine overbought and oversold conditions, and the ADX indicator to gauge trend strength, allowing entries during uptrends when not overbought and exits when trends weaken or become overbought.
Strategy Logic
The strategy mainly utilizes a combination of the RSI indicator and the ADX indicator to determine entries and exits.
Entry conditions:
20-day SMA rising;
ADX rising more than 0.2 from previous day, indicating strengthening trend;
RSI below 85 to avoid overbought state;
Or:
20-day SMA rising;
ADX rising but less than 0.2, indicating mild trend;
RSI below 50, room for rebound.
Exit conditions:
RSI above 75, overbought state;
ADX mild rise, weak trend;
Or:
RSI above 75, overbought state;
ADX sharp rise, strong trend;
Or:
20-day SMA turning down.
The strategy uses RSI for overbought/oversold and ADX for trend to enter during uptrends when not overbought and exit when overbought or trend weakens. This allows following medium to long term uptrends.
Advantages
The main advantages of this strategy are:
Combining RSI and ADX allows more accurate trend and overbought/oversold readings for better entries and exits.
ADX gauges trend strength to avoid whipsaw exits during consolidation.
RSI uses loose parameters to follow medium to long term trends and reduce excessive trading.
Simple logic and easy implementation, suitable for long term holdings.
Configurable parameters allow flexibility.
Risks
The main risks are:
ADX lag may miss trend turning points leading to larger losses.
Stop loss may trigger late during cliff-like price drops, enlarging losses.
RSI parameters too loose may cause overbought holdings for too long.
ADX parameters too sensitive may wrongly trigger exits during weak trends.
Stocks may behave abnormally during market regime shifts.
Risk management:
Use shorter ADX periods for sensitivity.
Tighter stop loss to limit losses.
Shorten RSI periods to avoid prolonged overbought holdings.
Avoid ADX parameters too sensitive.
Manually override during significant market shifts.
Enhancements
The strategy can be optimized by:
Testing RSI periods for better parameters.
Optimizing ADX periods for trend capturing ability.
Adding other indicators like MACD for confirmation.
Testing moving average combinations to improve entries.
Adding profit taking and stop losses to enhance risk-reward ratio.
Judging market regimes to manually override at turning points.
Conclusion
The RSI Tracking ADX strategy is an effective yet simple trend following strategy. It synergizes the strengths of RSI and ADX for accurate trend and overbought/oversold analysis. The logic is straightforward and easy to implement with optimization flexibility. Caution is needed against ADX lag and stop loss setting. Overall it is suitable for medium to long term trend tracking and can provide steady profits.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 14 | ADX Smoothing |
| v_input_2 | 14 | DI Length |
Source Pine Script
/*backtest
start: 2022-10-03 00:00:00
end: 2023-10-09 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//Copyright by Reed Asset Management registered in Shanghai, China
//This strategy is produced by Shanghai Lutian Asset Management Co., Ltd.
//@version=2
strategy("[Ashida Strategy]ADX+RSI", overlay=true)
//ADX
adxlen = input(14, title="ADX Smoothing")
dilen = input(14, title="DI Length")
dirmov(len) =>
up = change(high)
down = -change(low)
truerange = rma(tr, len)
plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange)
minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / truerange)
[plus, minus]
adx(dilen, adxlen) =>
[plus, minus] = dirmov(dilen)
sum = plus + minus
adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)
sig = adx(dilen, adxlen)
plot(sig, color=red, title="ADX")
//ADX+RSI Strategy Long Entry
longEntry1 = sma(close, 20) > sma(close, 20)[1] //check if the ADX is rising
longEntry2 = (adx(14, 14) - adx(14, 14)[1]) > 0.2
longEntry3 = rsi(close, 14) < 85
longEntry4 = (adx(14, 14) - adx(14, 14)[1]) > 0
longEntry5 = (adx(14, 14) - adx(14, 14)[1] ) < 0.2
longEntry6 = rsi(close, 14) < 50
longCondition1 = longEntry1 and longEntry2 and longEntry3
longCondition2 = longEntry1 and longEntry4 and longEntry5 and longEntry6
if(longCondition1 or longCondition2)
strategy.entry("long", strategy.long)
//ADX+RSI Strategy Long Exit
longExit1 = rsi(close, 9) > 75
longExit2 = (adx(14, 14) - adx(14, 14)[1]) > 0
longExit3 = (adx(14, 14) - adx(14, 14)[1] ) < 0.2
longExit4 = (adx(14, 14) - adx(14, 14)[1]) > 0.2
longExit5 = sma(close, 20) < sma(close,20)[1]
longExitCondition1 = longExit1 and longExit2 and longExit3
longExitCondition2 = longExit1 and longExit4
longStop1 = strategy.position_avg_price + 4 * tr
longExitCondition3 = longExit5
longStop2 = sma(close, 20)
strategy.close_all(when = longExitCondition1)
if (longExitCondition2)
strategy.exit("exit", "long", stop = longStop1)
if (longExitCondition3)
strategy.exit("exit", "long", stop = longStop2)
//Strategy
Published by ChaoZhang on the FMZ strategy square · last modified 2023-10-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/RSI-Tracking-ADX-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
- Trend Reversal Momentum Indicators Crossover Tracking StrategyPine Script · Mean reversion · 1h
- Multi Dimensional Technical Indicator Cross Confirmation Buy Signal Optimization StrategyPine Script · Mean reversion · 1d
- RePaNoCHa Quantitative Trading StrategyPine Script · Mean reversion · 1d
- Intraday Single Candle Indicator Combo Short Term Trading StrategyPine Script · Mean reversion · 1d
- Johnys BOTPine Script · Mean reversion · 4h
- DMI and Moving Average Combination StrategyPine Script · Mean reversion · 10m