Notifications
Clear all

Stackedbar ADX

Mike
 Mike
(@vanguardai)
Co-Founder Admin

ADX is a very good trend indicator that can be used in tandem with other indicators to make a wholistic trading system. A trend following trader can make a script that only takes buy signals whenever the ADX is above 25 (a trend is deemed strong if ADX is more than 25). Short term traders can also use the same settings in order to trade pullbacks within a strong trend. The downside of ADX is that it is inherently a lagging indicator and that it has no directional bias, ADX>25 will mean either a strong uptrend or a strong downtrend. When using this indicator to filter out trending stocks, consider including a directional or trend filter to make sure you only take signals from a strong uptrend.

The conventional ADX is plotted as a line graph with a horizontal line at 25 so users can see if ADX is above or below 25. With VAI, we can customize this one step further by changing it into a bar or stackedbar graph and change the colors to green (if ADX>25) and gray (if ADX <25). You can find the script below:

// Set ADX
Set ADX = adx(14)

//Plot ADX
Set ADXup = if(ADX > 25, ADX ,0)
Set ADXdown = if(ADX < 25, ADX, 0)
plot(ADXup,stackedbar, green, ADX)
plot(ADXdown, stackedbar, gray, ADX)

1619853745-ADXbars.png
Quote
Topic starter Posted : 01/05/2021 3:22 pm
Mike
 Mike
(@vanguardai)
Co-Founder Admin

I pushed this one step further by adding a trend filter. The script below will produce a green bar if prices are trending up (ADX >25 and close> EMA50), red if trending down (ADX>25 and close < EMA50) and gray if ADX <25. You can change the trend filter to whatever fits your trading style; it can be a shorter term EMA, a positive MACD, the slope of ALMA, etc. You can find the script below

// Set ADX Stackedbar with Trend
Set ADX = adx(14)
set EMA = ema(close,50)
Set yes = close > ema and adx > 25
Set no = close < ema and adx >25
Set uptrend= if(yes,adx,0)
set downtrend = if(no,adx,0)
Set ADXup = if(ADX > 25, uptrend ,downtrend)
Set ADXdown = if(ADX < 25, ADX, 0)
plot(ema,line,red,main)
plot(uptrend,stackedbar,green,adx)
plot(downtrend,stackedbar,red,adx)
plot(adxdown, stackedbar,gray,adx)

1619855485-ADXbars-with-trend.png
This post was modified 3 months ago 3 times by Mike
ReplyQuote
Topic starter Posted : 01/05/2021 3:51 pm
Share: