indicators

How to Automate ADX Indicator Strategy Without Coding

The ADX indicator, or Average Directional Index, measures how strong a trend is. It does not tell you which way the trend is moving. ADX runs from 0 to 100. A reading above 25 usually means a strong trend, and a reading below 20 means a weak or sideways market.

ADX comes with two partner lines, +DI and -DI, that show direction. Traders use ADX to decide whether a trend is worth trading, and the DI lines to decide which side to take.

This guide explains how to read ADX, which settings to use, and how to backtest and automate an ADX strategy on Nifty with SurendraAlgo Signals AI, without writing code.

Have an ADX rule in mind? Create your free SurendraAlgo account and test it on past Nifty data before you trade it.

What Is the ADX Indicator?

J. Welles Wilder introduced ADX in 1978, in his book New Concepts in Technical Trading Systems. It is part of his Directional Movement System, which plots three lines:

  • The ADX line shows how strong the trend is.

  • The +DI line (Positive Directional Indicator) shows how strong the upward moves are.

  • The -DI line (Negative Directional Indicator) shows how strong the downward moves are.

ADX itself has no direction. A sharp fall in Nifty can push ADX up just as much as a sharp rally, because both are strong trends.

On TradingView, the ADX indicator shows only the ADX line. To see ADX, +DI and -DI together, add the DMI (Directional Movement Index) indicator instead.

How to Read the ADX Indicator

ADX reading

What it usually means

How traders use it

Below 20

Weak trend or sideways market

Skip trend-following entries; range strategies may fit better

20 to 25

Grey zone

Wait for ADX to confirm before acting

Above 25

Strong trend

Consider trend-following entries

Above 40

Very strong trend

Watch for ADX turning down as the move matures

The direction of ADX matters as much as its level:

  • A rising ADX means the trend is getting stronger, whether price is going up or down.

  • A falling ADX means the trend is losing strength, which does not always mean a reversal.

  • When +DI is above -DI, buyers are in control, and when -DI is above +DI, sellers are in control.

For example, say Nifty has been climbing for a few sessions. ADX rises from below 20 to above 25 while +DI stays above -DI. That points to an uptrend that is gaining strength. If ADX then flattens and turns down while price drifts sideways, the trend is fading.

How Is ADX Calculated?

You don't need to calculate ADX by hand, because charting tools and Signals AI do it for you. Knowing the steps still helps you understand why it behaves the way it does.

  1. Compare each candle's high and low with the previous candle to measure upward movement (+DM) and downward movement (-DM).

  2. Smooth +DM and -DM over 14 periods and divide each by the smoothed true range. Multiply by 100 to get +DI and -DI.

  3. Calculate DX: the gap between +DI and -DI, divided by their sum, multiplied by 100.

  4. Smooth DX over 14 periods to get ADX.

All this smoothing makes ADX a lagging indicator. It confirms a trend that has already started rather than predicting a new one.

Best ADX Settings

Wilder's default period is 14. It is the standard setting on most platforms, including Signals AI. Traders also use periods as short as 7 or as long as 30.

  • A shorter period, such as 7 to 10, reacts faster but gives more false readings.

  • A longer period, such as 20 to 30, is smoother but slower to confirm a trend.

  • Wilder's trend threshold is 25, though many traders use 20 to catch trends earlier.

The right setting also depends on your timeframe. A 14-period ADX on a 5-minute Nifty chart behaves very differently from one on a daily chart. Pick a setting, then test it on the instrument and timeframe you actually trade.

3 Ways to Use the ADX Indicator in Trading

1. ADX-filtered DI crossover

This is Wilder's classic trend-following setup, and it is the one we automate later in this guide.

  • Go long when ADX(14) is above 25 and +DI(14) crosses above -DI(14).

  • Exit when +DI(14) crosses below -DI(14).

The ADX filter keeps you out of weak trends, and the DI crossover sets the direction. For short trades, flip the DI condition.

2. ADX as a sideways filter for option selling

When ADX stays below 20, the market is likely range-bound. Some option sellers use this as a condition to sell premium.

The Sideways template in Signals AI uses ADX(14) below 20 as its entry signal. It pairs that signal with a short straddle, short strangle, short iron fly or short iron condor. Selling options can lead to large losses if the market moves sharply, so check the margin and add a stop-loss before you deploy.

3. ADX as a confirmation filter for other indicators

ADX works well as a second filter. For example, the Supertrend indicator gives false flips in sideways markets, so traders often take its signals only when ADX is above 25. The same idea works for EMA crossovers.

For more ideas on which indicators pair well together, see our guide to the best indicators for option trading.

Turn any of these ADX rules into a live signal with Signals AI, no code needed.

How to Automate an ADX Strategy With Signals AI

Watching ADX, +DI and -DI line up in real time is hard, and it is easy to miss or second-guess a signal. Many algo trading platforms in India need TradingView alerts or code to automate a strategy like this. With Signals AI, you build, test and run it inside SurendraAlgo.

You need an active Signal Plan to use Signals AI. Backtests are included: 5 a week on the 1-month plan and unlimited on the 6-month plan.

Step 1: Open Signals AI and choose your chart

Log in to SurendraAlgo and open Signals AI. You will see the Canvas, the visual strategy builder, next to the AI Agent chat.

Select NIFTY as the instrument and Spot as the chart data, so that ADX is calculated on the index price. This guide uses a 5-minute timeframe.

adx indicator

Step 2: Describe the strategy to the AI Agent

Type your rules in plain English. A good prompt names the instrument, the chart data and timeframe, the entry condition and the exit condition.

Prompt

Create an ADX strategy on NIFTY spot, 5-minute timeframe. Entry: ADX(14) is greater than 25 AND +DI(14) crosses above -DI(14). Exit: +DI(14) crosses below -DI(14).

The AI builds the strategy on the Canvas as connected blocks. You can also build it yourself. Add Comparison Nodes, pick ADX, and choose the ADX, +DI or -DI line in the indicator settings. The full parameter list is in the Trend Indicators documentation.

Use "Crosses Above" for the DI entry, not "Greater Than". Greater Than stays true on every candle where +DI is above -DI, so it can fire again and again. Crosses Above fires only on the candle where the crossover happens.

For more prompt tips, read how to create trading signals with AI.

adx indicator

Step 3: Check the signals on the Chart Preview

Open the Chart Preview tab and add ADX to the Nifty chart. Every entry and exit is marked on the chart.

Pick a few entry markers and check them. Was ADX above 25? Did +DI actually cross above -DI on that candle? If a marker looks wrong, fix the logic before you test it. The Entry & Exit Logs tab lists each signal with its exact time.

Step 4: Connect a trade and backtest

A signal only says when to act. To backtest it, you also need to define what to trade when it fires.

Open the Backtest Results tab and build a trade in the Leg Builder, for example buying one lot of a Nifty ATM call. Then click Start Backtest. You get cumulative P&L, win rate, max drawdown, year-wise returns and a downloadable trade log.

Check these before you move on:

  • Look at win rate together with average profit and average loss, because a trend strategy can make money with a modest win rate if its winners are bigger than its losers.

  • Check the maximum drawdown and ask whether you could sit through it without switching the strategy off.

  • Re-run the test with thresholds of 20 and 30 to see how sensitive the results are to the ADX level. Each run uses one weekly backtest on the 1-month plan.

  • Add slippage so the backtest is closer to what live orders will get.

Our guide on how to backtest indicator strategies before going live explains how to read these results in more detail.

Step 5: Save the signal and forward test it

Click Save Strategy and give it a clear name, such as "ADX DI Crossover NIFTY 5m". Then open Saved Signals and click Forward Test.

A forward test is SurendraAlgo's version of paper trading. The strategy watches live prices and places simulated trades, and it needs no money or broker connection. Its status shows "Listening" while it waits for your entry conditions.

Run it for at least a week for an intraday strategy, then compare the results with your backtest. If they are far apart, check the logic before going live.

Step 6: Set execution and go live with Algo Trade

When the forward test holds up, connect your broker. SurendraAlgo works with 65+ brokers. First, complete any algo trading requirements your broker has.

Next, set up Execution Settings:

  • quantity

  • entry and exit order types

  • whether conditions are checked on every price tick or only when a candle closes

You can also limit entries to certain weekdays or days to expiry.

Then click Algo Trade on your saved signal and deploy it. When your ADX conditions are met, SurendraAlgo places the order through your broker automatically. With NSE and BSE brokers, you still need to log in to your broker through SurendraAlgo each trading day.

Common Mistakes With the ADX Indicator

  • Treating a high ADX as a buy signal is a mistake, because ADX also rises in strong downtrends.

  • Using Greater Than instead of Crosses Above for the DI entry makes the signal fire on every candle where +DI leads.

  • Lowering the threshold below 20 without testing lets in many weak, choppy trades.

  • Forgetting that ADX lags leads you to expect entries earlier than the indicator can give them.

  • Testing on one timeframe and trading on another gives results that no longer match your backtest.

  • Going live straight after a backtest, without a forward test, leaves slippage and missed fills as surprises.

Turn the ADX Filter Into a Tested Strategy

An ADX rule is simple to write and hard to follow by hand. Decide your instrument and timeframe, the ADX threshold, the DI entry and the exit. Then check how those rules held up in trending and sideways phases, in past data and in live markets, before you put money behind them.

SurendraAlgo helps you go from an ADX idea to a strategy you can inspect, backtest and paper trade before deciding whether to deploy it.

Join us as we simplify algo trading in India.

FAQs

1. What does the ADX indicator tell you?

ADX tells you how strong a trend is, on a scale of 0 to 100. It does not show direction. For direction, look at the +DI and -DI lines.

2. What is a good ADX value?

A reading above 25 generally means a strong trend, and a reading below 20 means a weak or sideways market. Between 20 and 25 is a grey zone where many traders wait for confirmation.

3. What is the best ADX setting for intraday trading?

14 periods is the standard setting. Some intraday traders test shorter periods, such as 7 to 10, on 5-minute charts for faster signals, though these add more noise. Backtest the setting on the instrument and timeframe you trade.

4. Is ADX a leading or lagging indicator?

ADX is a lagging indicator. It is built from several rounds of smoothing, so it confirms a trend that has already started.

5. What is the difference between ADX and DMI?

DMI is the full Directional Movement system: +DI, -DI and usually the ADX line. ADX is only the trend-strength line. On TradingView, add DMI to see all three lines.

6. Can I use ADX for options trading?

Yes. Option buyers often wait for ADX above 25 so they trade only in strong trends. Option sellers often look for ADX below 20 as a sign of a range-bound market. Test either approach before using real money, because option selling can lead to large losses.

7. Can I automate an ADX strategy without coding?

Yes. In Signals AI on SurendraAlgo, you describe the ADX rules in plain English or build them on the Canvas. You can then backtest them, forward test them and deploy them through your broker.

Frequently Asked Questions

Can you automate an ADX indicator strategy without coding?
Yes. Platforms like SurendraAlgo Signals AI let you build and automate ADX-based strategies using a visual condition builder. You define your rules, such as ADX above 25 and +DI crossing above -DI, and the platform executes them automatically. No Python, no Pine Script, no API setup required.
What is the best ADX indicator setting for intraday trading in India?
The default period of 14 works well for most intraday setups on Indian indices like Nifty and BankNifty. On a 5-minute chart, ADX(14) gives you enough sensitivity to catch intraday trends without reacting to every small move. You can test shorter periods like 7 if you want faster signals, but expect more false positives.
What does ADX above 25 mean in trading?
It means the market is in a strong trend, either up or down. The ADX line itself does not tell you the direction. It only tells you the trend has enough strength to trade. Below 20, the market is likely ranging and trend-following strategies tend to underperform.
How do you set entry and exit conditions for an ADX crossover strategy?
The entry fires when ADX(14) is greater than 25 and +DI(14) crosses above -DI(14). Both conditions must be true at the same time. The exit fires when +DI(14) crosses below -DI(14), which signals the bullish momentum has reversed. These two rules form the complete base strategy.
How do I backtest an ADX indicator strategy on Nifty?
On SurendraAlgo, you set up your ADX conditions in Signals AI and run a backtest on Nifty cash data. You pick your timeframe, define entry and exit rules, and the platform runs the strategy across historical data. Look at profit factor, drawdown, and how the strategy performs during low-ADX periods specifically.
Is the ADX indicator good for algo trading in India?
Yes, because it is rule-based. ADX generates clear, measurable conditions, ADX above a threshold and DI crossovers, which makes it straightforward to automate. It works well on liquid Indian instruments like Nifty and BankNifty where signals execute cleanly without significant slippage.
What is the difference between ADX, +DI, and -DI?
ADX measures how strong the current trend is. +DI measures the strength of upward price movement. -DI measures the strength of downward price movement. You need all three together. ADX tells you if a trend is worth trading. The DI lines tell you which direction it is moving.
ESC
Type to search...
↑↓ Navigate↡ Openesc Close