A MetaTrader-default oscillator that compares successive highs and lows — not closes — on a 0-to-1 scale.
The DeMarker (DeM), attributed to Tom DeMark, is one of MetaTrader 4 and 5's default oscillators, which gives it enormous reach among forex traders despite thin English-language documentation. It measures directional pressure by comparing each bar's high to the previous bar's high and each bar's low to the previous bar's low — unlike RSI, CMO, or the Momentum indicator, it never looks at closing prices at all. The result is plotted on a 0-to-1 scale (some platforms rescale to 0–100) with conventional reference bands at 0.30 and 0.70. The exact MetaTrader formula is: DeMax = high − high[1] when the current high is greater, else 0; DeMin = low[1] − low when the current low is lower, else 0; DeM = SMA(DeMax, N) / (SMA(DeMax, N) + SMA(DeMin, N)), with N defaulting to 14. Because the smoothing is a simple moving average of these one-sided range extensions, the indicator reads as the share of recent bar-to-bar expansion that happened on the upside. Like every oscillator, DeM describes what recent bars did; it does not predict what price will do next. This is educational material, not financial advice, and trading always involves risk of loss.
On each bar, two quantities are computed. DeMax captures upward range extension: if the current high exceeds the previous high, DeMax equals that difference; otherwise it is zero. DeMin captures downward extension symmetrically: if the current low is below the previous low, DeMin equals the previous low minus the current low; otherwise zero. An inside bar — lower high and higher low — contributes zero to both. Both series are then smoothed with a simple moving average over N bars (14 by default in MetaTrader), and the DeMarker value is the smoothed DeMax divided by the sum of smoothed DeMax and smoothed DeMin. The structure is deliberately parallel to RSI — an 'up amount' normalized by total movement — but with two substantive differences: the inputs are high/low extensions rather than close-to-close changes, and the smoothing is a plain SMA rather than Wilder's running average. Using highs and lows means DeM responds to bars that probe new territory even when closes are flat, and ignores large close-to-close moves that stay inside the prior bar's range. The SMA smoothing means old bars drop out of the window abruptly, so the line can move because a large extension from N bars ago expired, not because of anything on the current bar.
Period 14 with bands at 0.30 and 0.70 is the MetaTrader default and by far the most common configuration. Shorter periods (such as 8–10) make the line reach the bands more often and whipsaw more; longer periods (such as 21–25) smooth it at the cost of responding later. There is no evidence that any particular setting is 'best' — changing the period changes every reading, so settings are something to test and understand, not assume.
//@version=6
indicator("DeMarker Example", overlay = false)
length = input.int(14, "Length", minval = 1)
// Exact MetaTrader construction
deMax = high > high[1] ? high - high[1] : 0.0
deMin = low < low[1] ? low[1] - low : 0.0
avgMax = ta.sma(deMax, length)
avgMin = ta.sma(deMin, length)
// Guard the flat-window edge case where both averages are zero
dem = (avgMax + avgMin) == 0 ? 0.5 : avgMax / (avgMax + avgMin)
plot(dem, "DeMarker", color = color.blue)
hline(0.70, "Upper", color = color.gray)
hline(0.50, "Midline", color = color.new(color.gray, 50))
hline(0.30, "Lower", color = color.gray)Pro tip: If you port DeMarker between MetaTrader and TradingView, verify the port against the MT built-in on the same symbol and timeframe before trusting it — scale (0–1 vs 0–100), the SMA smoothing, and the strict greater-than/less-than comparisons are all easy to get subtly wrong, and a near-miss implementation produces plausible-looking but different values. Read DeM as one description of recent range extension alongside price structure, not as a standalone trigger. Educational content only — no indicator is predictive, and trading involves risk of loss.
Educational only — not financial advice, not a recommendation to trade. No indicator is predictive; trading involves substantial risk of loss.