Holy Grail ADX Trading Setup for ThinkorSwim

@svencool

ADX(14) is higher than 30

ADX(14) in this period is higher than ADX(14) in the last period

You can easily build these conditions without coding. Use the scanner's conditional wizard.

Here is an example:

TMgk8f5.png
 
@svencool





You can easily build these conditions without coding. Use the scanner's conditional wizard.

Here is an example:

TMgk8f5.png
I did just that and scanned all symbols with no results. So I got with the guys at TD Ameritrade traders desk and they couldn't figure it out either. The left side I would guess is referring to the ADX of today and the right side is referring to the ADX 1 bar previous? Sorry for asking a stupid question!
 
@svencool When testing a strategy, break it down into its individual parts and then add them one at a time to determine where the issue crops up.

So I tested
ADX() is greater than ADX() from 1 bars ago found 1000 stocks

Then I tested
ADX() is greater than 30 and
ADX() is greater than ADX() from 1 bars ago
That cut the results down to less than 400 stocks. The pool is getting smaller.

Then I tested
high is greater than SimpleMovingAvg("length" = 20)."SMA" and
low is less than SimpleMovingAvg("length" = 20)."SMA"
(this is a butt-ugly filter and I didn't expect it to work)
AND
ADX() is greater than 30 and
ADX() is greater than ADX() from 1 bars ago

Good news, your scan does definitely work. However, at any one moment, not many stocks will meet your exacting filters as you have currently defined them.
80twlXb.png

Here is a shared link: http://tos.mx/HHXjQET
HTH
 
Last edited:
@svencool
Ruby:
# I still say that your filter shown below is ugly
high is greater than SimpleMovingAvg("length" = 20)."SMA" and
low is less than SimpleMovingAvg("length" = 20)."SMA"

# Personally I would replace it with:
close crosses above SimpleMovingAvg("length" = 20)."SMA"

The way you have it written it can be straddling the SMA on its way up or down and your results definitely have some down dogs.
Using my crossing above code narrowed the selection even more. Only one stock met all your conditions. BUT!!!! That stock is on its way up. Just IMHO.
 
Last edited:
ADX() is greater than ADX() from 1 bars ago

80twlXb.png

Here is a shared link: http://tos.mx/HHXjQET
HTH
Thank you MerryDay! Seeing that 1 line "ADX() is greater than ADX() from 1 bars ago" helped for me. When trying to build this yesterday I was messing with the Within 1 Bar instead of using the offset. I just wanted to see if I could do it LOL. Whether it pulls up meaningful stocks really wasn't the main objective. Was I seen some scan criteria that I had read and wanted to see if I could build a scan for it. I've got less than 3 weeks with TOS and have a ton to learn. But this was the only place that I've come across that seemed like people helped everyone dealing with tos....
 
@svencool this forum is sooooo amazing there is a wealth of information and equally amazing people who give so unselfishly of their time and knowledge. You have already delved into the scanner. Use the search function in the top right-hand corner to find other scanning setups in the various threads. By comparing how posters were modifying the various fields available, I was able to slowly able to discern each of their purposes.

The TOS platform has its quirks but I won't leave because I would lose this place to learn from. You are correct this forum stands out and is head&shoulders above any other TOS-related site.
 
You have already delved into the scanner. Use the search function in the top right-hand corner to find other scanning setups in the various threads. By comparing how posters were modifying the various fields available, I was able to slowly able to discern each of their purposes.

The TOS platform has its quirks but I won't leave because I would lose this place to learn from. You are correct this forum stands out and is head&shoulders above any other TOS-related site.
That's a good Idea I've been playing with the scanner for a few hours today and have learned a few things as well. I usually build something and then I go look at it in the condition wizard but them click over to the thinkScript Editor just to see how it was put together. Just trying to learn the basics and I will use the search function like you suggested. Thank you for helping!!!!
 
Well if you want "ultimate ADX/DMI" vwp, pullback entry indicator: I wrote one . Spend friggin 2 month polishing it to perfection . It is quite silly though even though its very accurate on trending stocks (over 95% accurate). ITs not hard to find pullback entry on trending stock. the trick is to find stock which will be trending (and not reverse/chop shortly)
here it is https://tos.mx/7X1yazr : guranteed to give perfect entry signals on trending stocks!
Any tips on how to use your indicator? Entry points, meaning of the various indicators, arrows, dots, lines? Thanks!
 
aDNj4Fl.png

@Griffin As @skynetgen stated, you can use any or all of the signals successfully in her study as long as that stock ends up TRENDING.
However, unless you have a crystal ball to predict that it is actually going to trend, as @skynetgen stated, this has limited use. When used on a stock that does not end up trending, there is potential for loss. That is why she wrote her post in frustration. She spent months on it and it doesn't have much potential.

This is why it is important to read the complete thread to get an understanding of how indicators work.
 
Last edited:
Hi,

This is modified only small code from original post of skynetgen user which is in thread https://usethinkscript.com/threads/holy-grail-adx-trading-setup-for-thinkorswim.618/

In lower panel of the below image there are green and orange arrows. I NEED HELP TO KEEP ONLY GREEN ARROWS AND TO REMOVE ORANGE ARROWS FROM LOWER PANEL.
Idea is to use this green arrow with "Dapbull" CYAN arrow shown in the skynetgen users indicator to identify trend.

Can someone please take a look.

dfPnuYy.jpg


Here is the code:
Ruby:
# Test_ADX_Bull
declare lower;

#Hint ADXCutoff: ADX cutoff treshold
input ADXCutoff = 20;
input DMILength = 6;
input DIRangeFilter=10;
input MaFastLength=9;

#DMI, ADX plots
def averageType = AverageType.WILDERS;
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), DMILength);
def "DI+" = 100 * MovingAverage(averageType, plusDM, DMILength) / ATR;
def "DI-" = 100 * MovingAverage(averageType, minusDM, DMILength) / ATR;
def DX = if ("DI+" + "DI-" > 0) then 100 * AbsValue("DI+" - "DI-") / ("DI+" + "DI-") else 0;
plot ADX = MovingAverage(averageType, DX, DMILength);


#adx cross plots
#pivots
def prange=2; #pivot range
def adxbull = ADX > lowest(ADX,prange)[1];
def adxbear = ADX < highest(ADX,prange)[1];
ADX.AssignValueColor(if adxbull then Color.BLUE else if adxbear then Color.DARK_ORANGE else Color.GRAY);
def ptrend=adx;
def adxPH= if isnan(ptrend[-1]) then 0 else lowest(ptrend,prange)[1] > ptrend and lowest(ptrend,prange)[-prange]> ptrend ;
def adxPL= if isnan(ptrend[-1]) then 0 else highest(ptrend,prange)[1] < ptrend and highest(ptrend,prange)[-prange]< ptrend ;
plot padxcross = if adxPH or adxPL then ADX else Double.NaN;
padxcross.SetPaintingStrategy(PaintingStrategy.POINTS);
padxcross.SetLineWeight(4);
padxcross.AssignValueColor( if adxPH then Color.DARK_GREEN else Color.DARK_RED);

plot adx_bull = ADX > lowest(ADX,prange)[1] and ADX[1] < lowest(ADX,prange)[2];
adx_bull.SetPaintingStrategy( PaintingStrategy.ARROW_UP);
adx_bull.AssignValueColor(if adx_bull > 0 then Color.GREEN else Color.ORANGE);
 
Last edited by a moderator:
@TOSuser
Ruby:
# Test_ADX_Bull
declare lower;

#Hint ADXCutoff: ADX cutoff treshold
input ADXCutoff = 20;
input DMILength = 6;
input DIRangeFilter=10;
input MaFastLength=9;

#DMI, ADX plots
def averageType = AverageType.WILDERS;
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), DMILength);
def "DI+" = 100 * MovingAverage(averageType, plusDM, DMILength) / ATR;
def "DI-" = 100 * MovingAverage(averageType, minusDM, DMILength) / ATR;
def DX = if ("DI+" + "DI-" > 0) then 100 * AbsValue("DI+" - "DI-") / ("DI+" + "DI-") else 0;
plot ADX = MovingAverage(averageType, DX, DMILength);


#adx cross plots
#pivots
def prange=2; #pivot range
def adxbull = ADX > lowest(ADX,prange)[1];
def adxbear = ADX < highest(ADX,prange)[1];
ADX.AssignValueColor(if adxbull then Color.BLUE else if adxbear then Color.DARK_ORANGE else Color.GRAY);
def ptrend=adx;
def adxPH= if isnan(ptrend[-1]) then 0 else lowest(ptrend,prange)[1] > ptrend and lowest(ptrend,prange)[-prange]> ptrend ;
def adxPL= if isnan(ptrend[-1]) then 0 else highest(ptrend,prange)[1] < ptrend and highest(ptrend,prange)[-prange]< ptrend ;
plot padxcross = if adxPH or adxPL then ADX else Double.NaN;
padxcross.SetPaintingStrategy(PaintingStrategy.POINTS);
padxcross.SetLineWeight(4);
padxcross.AssignValueColor( if adxPH then Color.DARK_GREEN else Color.DARK_RED);

def adx_bull = ADX > lowest(ADX,prange)[1] and ADX[1] < lowest(ADX,prange)[2];
plot greenarrow = if adx_bull > 0 then adx else double.NaN;
greenarrow.SetPaintingStrategy( PaintingStrategy.ARROW_UP);
greenarrow.SetDefaultColor(Color.GREEN);
Screenshot (101).png
 
aDNj4Fl.png

@Griffin As @skynetgen stated, you can use any or all of the signals successfully in her study as long as that stock ends up TRENDING.
However, unless you have a crystal ball to predict that it is actually going to trend, as @skynetgen stated, this has limited use. When used on a stock that does not end up trending, there is potential for loss. That is why she wrote her post in frustration. She spent months on it and it doesn't have much potential.

This is why it is important to read the complete thread to get an understanding of how indicators work.
@MerryDay I agree with you. IMO, ADX/DMI is a good indicator for trend strength, not entry/exit. ADX shows the strength of the trend UP or DOWN trend. It is best for anyone interested to search youtube for how this indicator best use.

From the scripts and codes I've gathered here, I've combined a lower ADX/DMI indicator and added additional labels that I feel I needed. I find it works best with 15min and 1hr timeframe with DMILength = 6; MaFastLength=9; DIRangeFilter=10; ADXCutoff = 25;. Screenshot below. Let me know if you would like the ADX/DMI script/code, not the workspace, and I can post it here. Good luck! @cabe1332
 
Last edited by a moderator:
@MerryDay I agree with you. IMO, ADX/DMI is a good indicator for trend strength, not entry/exit. ADX shows the strength of the trend UP or DOWN trend. It is best for anyone interested to search youtube for how this indicator best use.

From the scripts and codes I've gathered here, I've combined a lower ADX/DMI indicator and added additional labels that I feel I needed. I find it works best with 15min and 1hr timeframe with DMILength = 6; MaFastLength=9; DIRangeFilter=10; ADXCutoff = 25;. Screenshot below. Let me know if you would like the ADX/DMI script/code, not the workspace, and I can post it here. Good luck! @cabe1332

4J6o7Aw.png


Yueqspu.png
Seen this in another thread, that indicator would be a lifesaver. Trying to maximize my day trading setups
 
Seen this in another thread, that indicator would be a lifesaver. Trying to maximize my day trading setups
Hi All, below is the script I've put together coming/learning from this site. As a Trend Trader and holding pos longer are profitable. The quick scalp is a bit stressful and requires leverage, which I don't have at this time. The script provides conditions and a quick glance before you decide on pos entry or exit. For simplicity, the colored ADXCutoff dots. Please watch some youtube clips to better used ADX/DMI indicators. It is a lifesaver. Good luck! @cabe1332
Ruby:
# ADX_DMI indicator
# cabe1332
# 20210814

# ADX code start
declare lower;

# You can modify ADX setting below to you liking

input ADXCutoff = 25;
input DMILength = 6;
input MaFastLength=9;
input DIRangeFilter=10;


#DMI, ADX plots
def averageType = AverageType.WILDERS;
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), DMILength);
def "DI+" = 100 * MovingAverage(averageType, plusDM, DMILength) / ATR;
def "DI-" = 100 * MovingAverage(averageType, minusDM, DMILength) / ATR;
def DX = if ("DI+" + "DI-" > 0) then 100 * AbsValue("DI+" - "DI-") / ("DI+" + "DI-") else 0;
plot ADX = MovingAverage(averageType, DX, DMILength);

#DIline - small diff = sideways
def DIrange = AbsValue(AbsValue("DI+")-AbsValue("DI-"));
#dirange.setPaintingStrategy(paintingStrategy.HISTOGRAM);
def DIok=DIRange>DIRangeFilter;

#adx filters
plot adxavg = MovingAverage(AverageType.SIMPLE, ADX, DMILength);
def ADXOk = ADX > ADXCutoff;# and adx>adxavg;

def DMICutBull = ("DI-" < ADXCutoff and "DI+" > ADXCutoff) or ("DI+" > ADX and "DI-" < ADX) ;
def DMICutBear = ("DI+" < ADXCutoff and "DI-" > ADXCutoff) or ("DI+" < ADX and "DI-" > ADX);

def dxcrossBull = if IsNaN(dxcrossBull[1]) then "DI+" > "DI-" #for init -what it is on first bar
else if "DI+" crosses above "DI-" then 1
else if dxcrossBull[1] > 0 and "DI+" > "DI-" then 1
else 0;
#plot dxXBull=dxCrossBull;
def dxcrossBear = if IsNaN(dxcrossBear[1]) then "DI-" > "DI+"
else if "DI+" crosses below "DI-" then 1
else if dxcrossBear[1] > 0 and "DI+" < "DI-" then 1
else 0 ;
#plot dxXBear=dxCrossBear;
#==========Pivots
def pivotprice=close;

#pivots per sami. changed logic for watchlist so there is no [-1]
def engbull= close>high[1] and low<=low[1];
def engbear= close<low[1] and high>=high[1];
def pivotHigh=(low[2] >low[1] and low>low[1] and close>pivotprice[1]) or engbull ;
def pivotLow=(high[2] <high[1] and high<high[1] and close<pivotprice[1]) or engbear;

def lastPH= if isnan(close[1]) then low else if PivotHigh then low[1] else LastPH[1];
def lastPL= if isnan(close[1]) then high else if PivotLow then high[1] else LastPL[1];

def breakout=if close> lastPL and close[1]<= lastPL then 1 else 0 ;
def breakdown= if close< lastPH and close[1]>= lastPH then 1 else 0;
#=============================

def signalbull = if dxcrossBull and ADXOk and DIOk then 1 else 0;
def signalbear = if dxcrossBear and ADXOk and DIOk then 1 else 0;

# ignore the signal if prevsignal was same direction and had higher DI
def signal = if signalbull then 1 else if signalbear then -1 else 0;

def prevSignal = if IsNaN(prevSignal[1]) then signal[1]
else if (signal[1] <> signal) then signal[1]
else prevSignal[1];

def DAPEntry = if signalbull and !signalbull[1] and prevSignal <= 0 then 1
else if signalbear and !signalbear[1] and prevSignal >= 0 then -1
else 0;


# Entry based on mas
input ATRMult = 0.3;
def MAFast = ExpAverage(close, MaFastLength);

#vwap
def vwp = reference VWAP("time frame" = "DAY");
def ATRMod = ATRMult * ATR;

def uptrend = signalbull;
def downtrend = signalbear ;

def PivotEntry = if uptrend and pivothigh then 1
else if downtrend and pivotlow then -1
else 0 ;

def VWPPB = if uptrend and low <= vwp + ATRMod and close > vwp then 1
else if downtrend and high >= vwp - ATRMod and close < vwp then -1
else 0 ;
#significant cross
def sigcross = if MAFast crosses above vwp and uptrend then 1.5
else if MAFast crosses below vwp and downtrend then -1.5
else 0;

#=== combined entry signal
def entry =
if sigcross <> 0 then sigcross
else
if VWPPB > 0 and pivotEntry>0 then 2
else if VWPPB < 0 and pivotEntry<0 then- 2
else if pivotEntry>0 then 1
else if pivotEntry<0 then -1
else 0
;
#======study display

plot pDIPlus = "DI+";
plot pDIminus = "DI-";
pDIPlus.SetDefaultColor(Color.GREEN);
pDIminus.SetDefaultColor(Color.RED);
AddCloud(pDIPlus, pDIminus, Color.UPTICK);

#plot padxcutoff = ADXCutoff;
plot padxcutoff = if !isnan(close) then ADXCutoff else double.nan;
padxcutoff.assignValueColor(if (adx < adxCutoff) or (pDiminus > adxcutoff) or (pDiplus < adxCutoff) then color.light_red else Color.green);
padxcutoff.SetLineWeight(1);
padxcutoff.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);

#adx cross plots
#pivots
def prange=2; #pivot range
def adxbull = ADX > lowest(ADX,prange)[1];
def adxbear = ADX < highest(ADX,prange)[1];

ADX.AssignValueColor(if adxbull then Color.cyan else if adxbear then Color.orange else Color.GRAY);

def ptrend=adx;
def adxPH= if isnan(ptrend[-1]) then 0 else lowest(ptrend,prange)[1] > ptrend and lowest(ptrend,prange)[-prange]> ptrend ;
def adxPL= if isnan(ptrend[-1]) then 0 else highest(ptrend,prange)[1] < ptrend and highest(ptrend,prange)[-prange]< ptrend ;

# Trend Direction

def dmisprd = pdiPlus - pdiMinus;

AddLabel(yes, if DMICutBull then "Trend Status: UP | D+: " + round(pdiPlus,2) + " D-: " + round(pdiMinus,2) + " Spread: " + round(dmisprd,2) else "Trend Status: DOWN | D-: " + round(pdiMinus,2) + " D+: " + round(pdiPlus,2) + " Spread: " + round(dmisprd,2), if DMICutBull then color.green else color.red);


# ADX Dynamic Label
# Adds ADX value and context

input ADXLength = 6;
input ADXLower = 25;
input ADXMid = 40;
input ADXHigh = 75;
#input MALength = 10;
input MALength = 9;

def ADXlabel = reference ADX(ADXLength).ADX;
def MA = reference movAvgExponential(close,MALength);

# ADX Label
AddLabel(yes, if ADXlabel < ADXLower then " Strenght: " + Round(ADXlabel,2) + " SETTING UP - Watch/Wait " else if ADXlabel < ADXMid then " Strenght: " + Round(ADXlabel,2) + " CHOPPY - Watch/Wait " else if ADXlabel < ADXlabel[1] then " Strenght: " + Round(ADXlabel,2) + " TREND WEAKENING " else if ADXlabel > ADXlabel[1] and MA > MA[1] and ADXlabel < ADXHigh then " Strenght: " + Round(ADXlabel,2) + " UPTRENDING " else if ADXlabel > ADXlabel[1] and MA < MA[1] then " Strenght: " + Round(ADXlabel,2) + " DOWNTRENDING " else if ADXlabel > ADXHigh then " Strenght: " + Round(ADXlabel,2) + " HIGH/WAIT TO COOL OFF " else " ", if ADXlabel < ADXLower then Color.CYAN else if ADXlabel < ADXMid then Color.RED else if (ADXlabel < ADXlabel[1]) then Color.YELLOW else if ADXlabel > ADXlabel[1] and MA > MA[1] and ADXlabel < ADXHigh then Color.GREEN else if ADXlabel > ADXlabel[1] and MA < MA[1] then Color.RED else if ADXlabel > ADXHigh then Color.MAGENTA else Color.light_gray);

# end of ADX
 
Last edited by a moderator:
@MerryDay I agree with you. IMO, ADX/DMI is a good indicator for trend strength, not entry/exit. ADX shows the strength of the trend UP or DOWN trend. It is best for anyone interested to search youtube for how this indicator best use.

From the scripts and codes I've gathered here, I've combined a lower ADX/DMI indicator and added additional labels that I feel I needed. I find it works best with 15min and 1hr timeframe with DMILength = 6; MaFastLength=9; DIRangeFilter=10; ADXCutoff = 25;. Screenshot below. Let me know if you would like the ADX/DMI script/code, not the workspace, and I can post it here. Good luck! @cabe1332
Hi All, I am also sharing the ADX Dynamic watchlist column script. This will provide you real-time ADX Strenght value of the trend for each stock on your watchlist. The colored strength value easily identifies the following trend GREEN = UP, RED = DOWN or CHOPPY, YELLOW = WEAKENING, CYAN = SETTING UP, and MAGENTA = HIGH/WAIT TO COOL OFF. I hope you will find the share useful. Please do let me know how it works out for you. Not asking much, a thank you will bring a smile or two. Good luck! @cabe1332

# ADX Dynamic Watchlist Column
# cabe1332

# code start
input ADXLength = 6;
input ADXLower = 25;
input ADXMid = 40;
input ADXHigh = 75;
#input MALength = 10;
input MALength = 9;

def ADXlabel = reference ADX(ADXLength).ADX;
def MA = reference movAvgExponential(close,MALength);

plot data = round(ADXlabel,1);
data.assignValueColor(if ADXlabel < ADXLower then Color.CYAN else if ADXlabel < ADXMid then Color.RED else if (ADXlabel < ADXlabel[1]) then Color.YELLOW else if ADXlabel > ADXlabel[1] and MA > MA[1] and ADXlabel < ADXHigh then Color.GREEN else if ADXlabel > ADXlabel[1] and MA < MA[1] then Color.RED else if ADXlabel > ADXHigh then Color.MAGENTA else Color.light_gray);

# code end
 
Last edited by a moderator:
Well if you want "ultimate ADX/DMI" vwp, pullback entry indicator: I wrote one . Spend friggin 2 month polishing it to perfection . It is quite silly though even though its very accurate on trending stocks (over 95% accurate). ITs not hard to find pullback entry on trending stock. the trick is to find stock which will be trending (and not reverse/chop shortly)
here it is https://tos.mx/7X1yazr : guranteed to give perfect entry signals on trending stocks!
WOW! this is a gem!
 
input tenkan_period = 9;
input kijun_period = 26;
input displace = 0;

plot Tenkan = (Highest(high, tenkan_period) + Lowest(low, tenkan_period)) / 2;
plot Kijun = (Highest(high, kijun_period) + Lowest(low, kijun_period)) / 2;

def tenkenbull = close > Tenkan;
def tenkenbear = close < Tenkan;
def kijunbull = close > Kijun;
def kijunbear = close < Kijun;

# Start ADX
input ADXlength = 14;
input ADXaverageType = AverageType.WILDERS;
def ADX = DMI(ADXlength, ADXaverageType).ADX;

def ADXpower = ADX > 20;

def bullish = tenkenbull and kijunbull and ADXpower;
def bearish = tenkenbear and kijunbear and ADXpower;

AssignPriceColor(if bullish then Color.GREEN else if bearish then Color.RED else Color.WHITE);
 
Spoiler: It's not the "holy grail". In trading, there is no such thing. This strategy was written by Linda Bradford Raschke and Larry Connors. We kept the name because it sounds cool.

Bullish Direction
  • 14-period ADX is above 30 and rising
  • Retracement down to 20-period SMA
  • Your entry would be at the high of the bar that touches 20-period simple moving average
Bearish Direction
  • 14-period ADX is above 30 and rising
  • Retracement up to 20-period SMA
  • Your short entry would be at the low of the bar that touches 20-period simple moving average
View attachment 5384
View attachment 5386

thinkScript Code

Code:
# The Holy Grail ADX Trading Setup
# Assembled by BenTen at useThinkScript.com
# This is NOT the Holy Grail! It was named that way by Linda Bradford Raschke and Larry Connors for its simplicity.

# You are free to use this code for personal use, and make derivative works from it.
# You are NOT GRANTED permission to use this code (or derivative works) for commercial
# purposes which includes and is not limited to selling, reselling, or packaging with
# other commercial indicators. Headers and attribution in this code should remain as provided,
# and any derivative works should extend the existing headers.

# Start SMA
input price = close;
input length = 20;
input displace = 0;

def SMA = Average(price[-displace], length);
def SMAbull = price > SMA;
def SMAbear = price < SMA;

# Start ADX
input ADXlength = 14;
input ADXaverageType = AverageType.WILDERS;
def ADX = DMI(ADXlength, ADXaverageType).ADX;

def ADXpower = ADX > 30;

def bullish = SMAbull and ADXpower;
def bearish = SMAbear and ADXpower;

AssignPriceColor(if bullish then Color.GREEN else if bearish then Color.RED else Color.WHITE);

I learned about this strategy from here, you should read up on it before using the indicator.
@BenTen is there a lower indicator as well?
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
415 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top