# ADX above 24 scan

#### MBF

##### Active member
2019 Donor
I am trying to set a study in my scan where ADX is above 24 but when I put it in it brings up stocks below that. What am I doing wrong?

#### horserider

##### Well-known member
VIP
ADXCrossover(threshold = 24)
or
ADX() is greater than or equal to 24
or
ADX() is greater than or equal to 24 within 3 bars

#### MBF

##### Active member
2019 Donor
ADXCrossover(threshold = 24) or
ADX() is greater than or equal to 24 or
ADX() is greater than or equal to 24 within 3 bars
Thank you @horserider !

#### tomsk

##### Well-known member
VIP
@MBF Here's the scan code for ADX above 24. Place this in the scanner. I obtained 214 hits on the S&P 500 on a daily aggregation scan

input length = 14;
input averageType = AverageType.WILDERS;
def ADX = DMI(length, averageType).ADX;
plot scan = ADX > 24;

#### MBF

##### Active member
2019 Donor
@MBF Here's the scan code for ADX above 24. Place this in the scanner. I obtained 214 hits on the S&P 500 on a daily aggregation scan

input length = 14;
input averageType = AverageType.WILDERS;
def ADX = DMI(length, averageType).ADX;
plot scan = ADX > 24;
@tomsk Thanks Tom!
Is there a way to scan for options that are ATM between \$40-65 with OI >900 and Volume >900? I scan for these and I'll look at the ATM and find the correct price of course but the options are all screwy, OI will be 300 and volume will 11 or something similar. I may be asking too much but have to ask.
Basically im looking for stocks between \$40 and \$65, 5cent or less spreads, high volume, volatility 40+, that have a good amount of OI and Volume. Its the OI and volume Im having trouble with.

#### cherif

##### Member
@MBF , actually if u are trying to catch stocks before they make their moves, ur scanner should include "adx crossing above 24" as a condition and not adx>24. the reason for this, there are times when adx is above 24 but it is decreasing in value and therefore the price move had slowed down or even reversed.

MBF

#### MBF

##### Active member
2019 Donor
@MBF , actually if u are trying to catch stocks before they make their moves, ur scanner should include "adx crossing above 24" as a condition and not adx>24. the reason for this, there are times when adx is above 24 but it is decreasing in value and therefore the price move had slowed down or even reversed.
Thank you. I will check that out!

#### horserider

##### Well-known member
VIP
Also consider if above 24 is an important level for you the > 24 may still be what you want. Th ADX could decline then reverse and remain above 24.
Just thought I would throw some confusion into this.

MBF

#### tomsk

##### Well-known member
VIP
@MBF your original request was for ADX above 24 so my earlier post #4 will indeed catch that
However if you are looking for a transition in ADX crossing the threshold 24 as described by @cherif , here is the code

input length = 14;
input averageType = AverageType.WILDERS;
def ADX = DMI(length, averageType).ADX;
plot scan = ADX crosses above 24;

It all really depends on what you're looking for. This is the first time I have seen the threshold 24 being mentioned though

#### MBF

##### Active member
2019 Donor
@MBF your original request was for ADX above 24 so my earlier post #4 will indeed catch that
However if you are looking for a transition in ADX crossing the threshold 24 as described by @cherif , here is the code

input length = 14;
input averageType = AverageType.WILDERS;
def ADX = DMI(length, averageType).ADX;
plot scan = ADX crosses above 24;

It all really depends on what you're looking for. This is the first time I have seen the threshold 24 being mentioned though
I read somewhere that when ADX is above 24 the stock is in or about to be in trend mode.
Anyway I scrapped it because what I was asking for in total was probably not viable.
Now I am trying to find a scan where on the five minute the price closes above the five minute SMA 30 or 34, cant get it to work yet apparently because this morning nothing popped up yet I was watching stocks cross and close on it.
I will look into the ADX a bit further, now you have me scratching my head about it

#### diazlaz

##### Well-known member
2019 Donor
VIP
I read somewhere that when ADX is above 24 the stock is in or about to be in trend mode.
Anyway I scrapped it because what I was asking for in total was probably not viable.
Now I am trying to find a scan where on the five minute the price closes above the five minute SMA 30 or 34, cant get it to work yet apparently because this morning nothing popped up yet I was watching stocks cross and close on it.
I will look into the ADX a bit further, now you have me scratching my head about it
@MBF take alook at the sideways indicator and see if and how you can pair it up with the ADX scan to minimize chop and the relationship to the ADX when it could be breaking to trend. Also see how the TTM Squeeze can be used in addition for confirmation.

MBF

#### J007RMC

##### Well-known member
2019 Donor
VIP
Well I do not write script but I do play with scans so I hope this will be of use for someone. This is a bull scan, https://tos.mx/o80jtl6

#### MBF

##### Active member
2019 Donor
@MBF take alook at the sideways indicator and see if and how you can pair it up with the ADX scan to minimize chop and the relationship to the ADX when it could be breaking to trend. Also see how the TTM Squeeze can be used in addition for confirmation.
Ah, thank you, was a little under the weather last night. Getting to this now.

2019 Donor

#### malinois1983

##### New member
VIP
So I don't own the code. I found it on the web but it is what I was looking for. I also just want to say sorry if this is a stupid question. Is there anyway to add a condition to this code that the ADX has to be above 25?

Code:
``````input length = 14;
input averageType = AverageType.WILDERS;
input threshold = 20;
input lookBack = 90;
def hiDiff = high - high[1];
def loDiff = low[1] - low;
def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
def minusDM = if loDiff > hiDiff and loDiff > 0 then loDiff else 0;
def ATR = MovingAverage(averageType, TrueRange(high, close, low), length);
def diPlus = 100 * MovingAverage(averageType, plusDM, length) / ATR;
def diMinus = 100 * MovingAverage(averageType, minusDM, length) / ATR;
def DX = if (diPlus + diMinus > 0) then 100 * AbsValue(diPlus - diMinus) / (diPlus + diMinus) else 0;
def diPlusCrossesAbove = diPlus[1] < diMinus[1] and diPlus > diMinus;
def diPlusCrossesBelow = diPlus[1] > diMinus[1] and diPlus < diMinus;
# use this scan to check for DI+ crossing above DI-
plot scan = Highest(diPlusCrossesAbove[1], lookBack) < 1 and diPlusCrossesAbove;
# use this scan to check for DI+ crossing below DI-
#plot scan = Highest(diPlusCrossesBelow[1], lookBack) < 1 and diPlusCrossesBelow;``````

Last edited by a moderator:

#### rad14733

##### Well-known member
VIP
@malinois1983 Here you go... Notice the 1st line and the addition to the end of your plot line...

Ruby:
``````def adx = ADX() >= 25;
input length = 14;
input averageType = AverageType.WILDERS;
input threshold = 20;
input lookBack = 90;
def hiDiff = high - high[1];
def loDiff = low[1] - low;
def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
def minusDM = if loDiff > hiDiff and loDiff > 0 then loDiff else 0;
def ATR = MovingAverage(averageType, TrueRange(high, close, low), length);
def diPlus = 100 * MovingAverage(averageType, plusDM, length) / ATR;
def diMinus = 100 * MovingAverage(averageType, minusDM, length) / ATR;
def DX = if (diPlus + diMinus > 0) then 100 * AbsValue(diPlus - diMinus) / (diPlus + diMinus) else 0;
def diPlusCrossesAbove = diPlus[1] < diMinus[1] and diPlus > diMinus;
def diPlusCrossesBelow = diPlus[1] > diMinus[1] and diPlus < diMinus;
# use this scan to check for DI+ crossing above DI-
plot scan = Highest(diPlusCrossesAbove[1], lookBack) < 1 and diPlusCrossesAbove;
# use this scan to check for DI+ crossing below DI-
#plot scan = Highest(diPlusCrossesBelow[1], lookBack) < 1 and diPlusCrossesBelow and adx;``````

VIP

#### malinois1983

##### New member
VIP
@rad14733 may I ask you a question? It appears my requirements are a little too stringent. Is there a scan or way to create a scanner that will tell me if I stock had a -DI and +DI crossover while the ADX was above 25 that can be within 20 days or whatever I choose to change it to?

I think this one Im using has it to where its only happened ONCE with 90 days or more in between crossings.

Ill keep scanning the web but I figured Id ask here since Ive found so much info on this site already

#### rad14733

##### Well-known member
VIP
@rad14733 may I ask you a question? It appears my requirements are a little too stringent. Is there a scan or way to create a scanner that will tell me if I stock had a -DI and +DI crossover while the ADX was above 25 that can be within 20 days or whatever I choose to change it to?

I think this one Im using has it to where its only happened ONCE with 90 days or more in between crossings.

Ill keep scanning the web but I figured Id ask here since Ive found so much info on this site already
For +-DI you would need the DMI() Study instead of the ADX() Study I presented...

Thread starter Similar threads Forum Replies Date
MTF ADX? Questions 2
Consecutive bar count for DMI and ADX? Questions 0
CM ADX System for ThinkorSwim Custom 6
Request: Add arrows and alert to Smart ADX Questions 0
ADX Cross backtesting strategy Questions 10