//@version=5
indicator("DEMA 200 & ADX Combined Indicator", shorttitle="DEMA+ADX HUD", overlay=true)
// ==========================================
// 1. INPUT PARAMETERS
// ==========================================
// DEMA Settings
gp_dema = "=== DEMA 200 Settings ==="
dema_len = input.int(200, minval=1, title="DEMA Length", group=gp_dema)
show_dema = input.bool(true, title="Show DEMA Line", group=gp_dema)
// ADX Settings
gp_adx = "=== ADX Settings ==="
adx_len = input.int(14, minval=1, title="ADX Length", group=gp_adx)
adx_threshold = input.int(20, minval=1, title="ADX Trend Strength Threshold", group=gp_adx, tooltip="Values above this threshold indicate a strong trend (typically 20 or 25).")
adx_tf = input.timeframe("30", "ADX Timeframe", options=["30", "60"], group=gp_adx, tooltip="Select ADX calculation timeframe: 30 (30 minutes), 60 (1 hour).")
color_bg_low_adx = input.bool(false, title="Highlight Low ADX Zones (Choppy Markets)", group=gp_adx, tooltip="Colors the background when ADX is below the threshold.")
// HUD Dashboard Settings
gp_hud = "=== HUD Dashboard Settings ==="
show_hud = input.bool(true, title="Show HUD Table", group=gp_hud)
hud_pos = input.string("top_right", title="HUD Position", options=["top_right", "top_left", "bottom_right", "bottom_left"], group=gp_hud)
hud_size = input.string("small", title="Text Size", options=["auto", "tiny", "small", "normal", "large"], group=gp_hud)
// ==========================================
// 2. INDICATOR CALCULATIONS
// ==========================================
// Double Exponential Moving Average (DEMA)
dema(src, length) =>
ema1 = ta.ema(src, length)
ema2 = ta.ema(ema1, length)
2 * ema1 - ema2
dema_val = dema(close, dema_len)
// Helper function to calculate DMI/ADX
f_dmi(len) =>
[p_di, m_di, adx] = ta.dmi(len, len)
[p_di, m_di, adx]
// Calculate ADX & Directional Movement on the requested timeframe
[plus_di, minus_di, adx_val] = request.security(syminfo.tickerid, adx_tf, f_dmi(adx_len), barmerge.gaps_off, barmerge.lookahead_off)
// Trend strength & direction conditions
is_trending = adx_val >= adx_threshold
is_bullish = plus_di > minus_di
is_bearish = minus_di > plus_di
// ==========================================
// 3. CHART PLOTS
// ==========================================
// Color DEMA line dynamically based on trend strength and direction:
// - Green: Bullish Trend (Price > DEMA and ADX >= Threshold)
// - Red: Bearish Trend (Price < DEMA and ADX >= Threshold)
// - Gray: Choppy / Weak Trend (ADX < Threshold)
dema_color = not is_trending ? color.gray :
(close > dema_val ? color.green : color.red)
plot(show_dema ? dema_val : na, title="DEMA 200", color=dema_color, linewidth=2)
// Color background when the market is choppy (Low ADX)
bgcolor(color_bg_low_adx and not is_trending ? color.new(color.orange, 95) : na, title="Low ADX Choppy Zone")
// ==========================================
// 4. HUD DASHBOARD TABLE
// ==========================================
// Convert position string input to Pine Script position type
getTablePosition(pos) =>
switch pos
"top_left" => position.top_left
"bottom_left" => position.bottom_left
"bottom_right" => position.bottom_right
=> position.top_right
// Convert text size string input to Pine Script size type
getTableTextSize(sz) =>
switch sz
"auto" => size.auto
"tiny" => size.tiny
"normal" => size.normal
"large" => size.large
=> size.small
var table hud = na
if show_hud
hud := table.new(getTablePosition(hud_pos), 2, 5, bgcolor=color.new(color.black, 20), border_color=color.gray, border_width=1)
if show_hud and barstate.islast
t_sz = getTableTextSize(hud_size)
// Header
table.cell(hud, 0, 0, "Indicator", text_color=color.white, bgcolor=color.blue, text_size=t_sz)
table.cell(hud, 1, 0, "Status / Value", text_color=color.white, bgcolor=color.blue, text_size=t_sz)
// Row 1: ADX (Trend Strength)
adx_status_text = is_trending ? "Trending (" + str.tostring(adx_val, "#.#") + ")" : "Choppy (" + str.tostring(adx_val, "#.#") + ")"
adx_status_color = is_trending ? color.green : color.orange
tf_suffix = adx_tf == "60" ? "1H" : adx_tf == "30" ? "30m" : adx_tf
table.cell(hud, 0, 1, "ADX (" + str.tostring(adx_len) + ") [" + tf_suffix + "]", text_color=color.white, text_size=t_sz)
table.cell(hud, 1, 1, adx_status_text, text_color=adx_status_color, text_size=t_sz)
// Row 2: DMI (+DI vs -DI)
dmi_status_text = is_bullish ? "+DI > -DI (Bullish)" : "-DI > +DI (Bearish)"
dmi_status_color = is_bullish ? color.green : color.red
table.cell(hud, 0, 2, "+DI / -DI", text_color=color.white, text_size=t_sz)
table.cell(hud, 1, 2, str.tostring(plus_di, "#.#") + " / " + str.tostring(minus_di, "#.#") + " (" + (is_bullish ? "Bull" : "Bear") + ")", text_color=dmi_status_color, text_size=t_sz)
// Row 3: DEMA 200 Relation
dema_status_text = close > dema_val ? "Price > DEMA (Bullish)" : "Price < DEMA (Bearish)"
dema_status_color = close > dema_val ? color.green : color.red
table.cell(hud, 0, 3, "DEMA " + str.tostring(dema_len), text_color=color.white, text_size=t_sz)
table.cell(hud, 1, 3, dema_status_text, text_color=dema_status_color, text_size=t_sz)
// Row 4: Combined Signal
combined_signal = ""
combined_color = color.white
if is_trending
if close > dema_val and is_bullish
combined_signal := "Strong LONG Signal"
combined_color := color.green
else if close < dema_val and is_bearish
combined_signal := "Strong SHORT Signal"
combined_color := color.red
else
combined_signal := "Mixed Trend"
combined_color := color.yellow
else
combined_signal := "No Trend (Avoid Trading)"
combined_color := color.gray
table.cell(hud, 0, 4, "Action Signal", text_color=color.white, text_size=t_sz)
table.cell(hud, 1, 4, combined_signal, text_color=combined_color, text_size=t_sz)
// ==========================================
// 5. ALERT CONDITIONS
// ==========================================
alertcondition(ta.crossover(close, dema_val), title="Price Crossed Above DEMA", message="Price crossed above DEMA {{interval}}")
alertcondition(ta.crossunder(close, dema_val), title="Price Crossed Below DEMA", message="Price crossed below DEMA {{interval}}")
alertcondition(ta.crossover(adx_val, adx_threshold), title="ADX Crossed Above Threshold (Trend Starts)", message="ADX crossed above threshold ({{value}})")
alertcondition(ta.crossunder(adx_val, adx_threshold), title="ADX Crossed Below Threshold (Trend Ends)", message="ADX crossed below threshold ({{value}})")
// Combined Alert signals
long_alert = is_trending and ta.crossover(close, dema_val) and is_bullish
short_alert = is_trending and ta.crossunder(close, dema_val) and is_bearish
alertcondition(long_alert, title="Combined Buy/Long Signal", message="Combined Long Signal on {{ticker}} at {{close}}")
alertcondition(short_alert, title="Combined Sell/Short Signal", message="Combined Short Signal on {{ticker}} at {{close}}")
Overview
The line turns green when price is above it and ADX is at or above a threshold, red when price is below it, and grey when ADX is weak. ADX and directional movement are read from a 30 or 60 minute timeframe. Optional shading marks low-ADX choppy zones, and a configurable table shows the readings.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
DEMA Length
int
200
dema_len
Show DEMA Line
bool
true
show_dema
ADX Length
int
14
adx_len
ADX Trend Strength Threshold
int
20
adx_threshold
ADX Timeframe
timeframe
30
adx_tf
Highlight Low ADX Zones (Choppy Markets)
bool
false
color_bg_low_adx
Show HUD Table
bool
true
show_hud
HUD Position
string
top_right
hud_pos
Text Size
string
small
hud_size
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
TradersPost Trading Checklist is an overlay indicator that evaluates a suite of popular technical conditions for long and short trade setups. It checks session-anchored VWAP, fast and slow EMA alignments and crosses, 200 SMA, RSI overbought or oversold conditi
This indicator plots five moving averages of a chosen source on the price chart, defaulting to EMA lengths 10, 20, 30, 40 and 50. The user can switch the average type to SMA, WMA or HMA and recolor each line. Wide translucent glows sit under the lines, and sof
Calculates exponential moving averages for fast, pivot, and slow lengths along with optional 50, 100, and 200 simple moving average context lines. It visualizes bullish and bearish ribbon fills on the main price chart alongside MACD calculations to generate ea
This indicator analyzes historical candle direction and price range over a configurable lookback window to gauge market trend. It categorizes trend direction using candle count, price range sum, or both. Signals are filtered using a Simple Moving Average to en
This indicator evaluates market momentum and risk by calculating trend metrics and volatility stats, displaying them in an on-chart table pane. It measures short-term and long-term trend strength via two MACD configurations built on three customizable EMA leng
Market Monitor - 15m is a directional bias chart overlay designed for 15-minute intraday chart analysis. It calculates a triple exponential moving average ribbon with EMA cloud shading, session VWAP with multiplier bands, prior day levels, a 30-minute opening