Strategy vault / Mean reversion
Trend Reversal Strategy Based on ADX Indicator
This strategy is named "Trend Reversal Strategy Based on ADX Indicator". It uses the ADX indicator to gauge trend strength and capture reversal opportunities when overbought/oversold. ADX stands for Average…
This strategy is named "Trend Reversal Strategy Based on ADX Indicator". It uses the ADX indicator to gauge trend strength and capture reversal opportunities when overbought/oversold.
ADX stands for Average Directional Index, reflecting the strength of a trend. The higher the ADX value, the stronger the trend. ADX above 25 suggests a significant trend is present.
DMI includes DI+ and DI- lines. DI+ above DI- shows an uptrend, while DI- above DI+ flags a downtrend.
The trading logic is:
When ADX is above 45, the trend is considered very steep.
If DI+ is below DI- then, it signals an oversold state and trend reversal opportunity, going long.
Conversely, if DI- is below DI+, it suggests overbought conditions and reversal opportunity for going short.
Take profit timely after reversal.
The advantage is using ADX to determine strong trend reversal points. High ADX values filter out false signals from ranging markets effectively. But ADX parameters need optimization, and stop loss is also important.
In conclusion, ADX is adept at gauging strong trend reversal timing. But traders still need to watch more factors, using ADX as just one supplementary indicator.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | true | From Month |
| v_input_2 | true | From Day |
| v_input_3 | 2021 | From Year |
| v_input_4 | true | Thru Month |
| v_input_5 | true | Thru Day |
| v_input_6 | 2112 | Thru Year |
| v_input_7 | true | Show Date Range |
Source Pine Script
/*backtest
start: 2023-08-13 00:00:00
end: 2023-09-12 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy(shorttitle='DMI swings',title='DMI swings', overlay=true, initial_capital = 100, process_orders_on_close=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, commission_type=strategy.commission.percent, commission_value=0.1)
//Backtest dates
fromMonth = input(defval = 1, title = "From Month", type = input.integer, minval = 1, maxval = 12)
fromDay = input(defval = 1, title = "From Day", type = input.integer, minval = 1, maxval = 31)
fromYear = input(defval = 2021, title = "From Year", type = input.integer, minval = 1970)
thruMonth = input(defval = 1, title = "Thru Month", type = input.integer, minval = 1, maxval = 12)
thruDay = input(defval = 1, title = "Thru Day", type = input.integer, minval = 1, maxval = 31)
thruYear = input(defval = 2112, title = "Thru Year", type = input.integer, minval = 1970)
showDate = input(defval = true, title = "Show Date Range", type = input.bool)
start = timestamp(fromYear, fromMonth, fromDay, 00, 00) // backtest start window
finish = timestamp(thruYear, thruMonth, thruDay, 23, 59) // backtest finish window
window() => true // create function "within window of time"
[pos_dm, neg_dm, avg_dm] = dmi(14, 14)
//Entry
strategy.entry(id="long", long = true, when = avg_dm > 45 and pos_dm < neg_dm and window())
//Exit
strategy.close("long", when = avg_dm > 45 and pos_dm > neg_dm and window())Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-13. 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/Trend-Reversal-Strategy-Based-on-ADX-Indicator.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
- Advanced Momentum EMA Trend Following with RSI Overbought Oversold Trading StrategyPine Script · Mean reversion · 1d
- Momentum Indicator RSI Reversal Trading StrategyPine Script · Mean reversion · 1d
- Moving Average Envelopes Trading StrategyPine Script · Mean reversion · 1h
- Multi Indicator Reversal Point Capture Trading StrategyPine Script · Mean reversion · 1d
- 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