DeMarker
The sum of new highs against the sum of new highs and new lows over N bars, from 0 to 1, comparing each bar's extremes with the previous bar's rather than with a window's.
It measures how much of recent movement extended the range in each direction. Conventional readings: above 0.7 called overbought and below 0.3 oversold.
01The study, live
Computed by Bentrix’s own code over the same synthetic bars on every page — an illustration of how the study behaves, not a market.
What this figure shows
The figure is computed over 300 sample bars. DeMarker has no value on the first 13 — the bars it needs before it can answer — and its first value stands on bar 14. Its line runs between 0.0835 and 0.9930 on these bars, and the last value is 0.7172. The pane's scale is fixed at 0 to 1, the range the study can take. Counting the conditions the study declares on these bars: crosses above 0.3 8 times; crosses below 0.3 8 times; crosses above 0.7 9 times; crosses below 0.7 9 times. Press a condition under the figure to see each place marked. As states rather than moments: is above 0.3 on 217 bars; is below 0.3 on 70 bars; is above 0.7 on 78 bars; is below 0.7 on 209 bars.
02Its parts, named
03What you see
An oscillator between 0 and 1, with lines at 0.3 and 0.7, comparing recent highs with previous highs and lows with previous lows.
04Where it comes from
Thomas DeMark, known for his exhaustion studies, described it in the 1990s.
05The formula
DeMaxₜ = max (Hₜ − H_(t−1), 0), DeMinₜ = max (L_(t−1) − Lₜ, 0)
DeM = (SMA(DeMax, N))/(SMA(DeMax, N) + SMA(DeMin, N))
06A worked example
The sample bars used here are eight: closes 20, 21, 23, 22, 24, 25, 24, 26; highs 21, 22, 24, 24, 25, 26, 26, 27; lows 18, 19, 20, 21, 21, 23, 23, 23; opens 19, 20, 21, 23, 22, 24, 25, 24.
Take a period of 4. For each bar, DeMax is how far its high rose above the previous high (zero if it did not), and DeMin how far its low fell below the previous low.
Over the last four bars the highs went 24 → 25 → 26 → 26 → 27, so DeMax is 1, 1, 0, 1: an average of 0.75. The lows went 21 → 21 → 23 → 23 → 23, so DeMin is 0, 0, 0, 0: an average of 0.00.
DeMarker = 0.75 / (0.75 + 0.00) = 1.00
A reading of 1 says that in this window no bar made a lower low at all. Had the lows fallen as much as the highs rose, the reading would be 0.5.
07Built in Assay
The same study written in Assay, Bentrix’s script language, and drawn by Bentrix itself as the script’s graph: each block is one step of the formula. On the ladder the steps stand in the script’s order, one a row; on the board each wire carries a value from the block that gives it to the block that reads it, left to right. The script computes exactly what the study computes — Bentrix checks the two against each other, candle by candle.
//@version=6 indicator("DeMarker") length = input.int(14, "Length") // How far each bar pushed above the previous high, and below the previous low. deMax = bar_index > 0 and high > high[1] ? high - high[1] : 0.0 deMin = bar_index > 0 and low < low[1] ? low[1] - low : 0.0 avgMax = ta.sma(deMax, length) avgMin = ta.sma(deMin, length) // The upward pushes as a share of all pushes, from 0 to 1. demarker = avgMax + avgMin == 0 ? 0.0 : avgMax / (avgMax + avgMin) plot(demarker, "DeMarker") hline(0.7) hline(0.3)
Paste it into the Assay IDE to put it on a chart, or to change it. Looking at the graph is free in every package; editing it as blocks is Plus.
08Readings — what traders look for
Above 0.7 is read as highs having expanded more than lows recently; below 0.3, lows more than highs.
How the 0.7 and 0.3 readings fail. Above 0.7, new highs have dominated new lows. In a strong trend the line stays at one end of its scale for a long time; a high reading there describes the trend and does not mark its end.
How long it stays. DeMark distinguished a brief visit beyond a level from a long stay, reading the long stay as a strong trend rather than an exhausted one. That distinction is only available afterwards.
09In different markets and timeframes
The DeMarker compares new highs with new lows and is steadier than close-based oscillators on markets whose closes are noisy. It is a range instrument; in a persistent trend it stays beyond 0.7 or 0.3.
10With other studies
Read beside the RSI: where they disagree, the bars' extremes and their closes are telling different stories. DeMark used it with his sequential counts.
11What it does not tell you
It measures how the bars' extremes have moved; an extreme reading describes that, not what follows.
12Inputs and defaults
- 1Period — 14The window over which the rises of the highs and the falls of the lows are averaged. DeMark's own choice was 14 (and 13 in some of his writing).
- 2Timeframe — ChartThe chart's own by default; any higher one, read on the last closed candle. A finer one is never offered.
- 3Wait for the candle to close — OnThe value of a higher timeframe is taken only from a candle that has finished.
The settings in use
- In use14 by default; 13 in DeMark's own writing; 8 for a quicker line.
13Limits and common misreadings
It ignores the close. Only highs and lows enter; a bar that closes at its low after a higher high still counts as upward.
A simple average, so each bar drops out of the window abruptly.
Scale. Here it runs from 0 to 1; some platforms show the same thing from 0 to 100.
14Conditions an alert or a strategy can watch
an event happens on one bar a state holds on every bar while it lasts
These are the conditions the study itself declares — the same rules the alert editor and the strategy engine read, and the ones the figure's chips show.
15Practise it in the laboratory
Put DeMarker 14 and RSI 14 in two panes and replay a trend with deep closes against it; note where the two disagree and look at the highs and lows that explain it.
Open the laboratory17In Bentrix
- From the menu: a chart's Indicators button › Oscillators › DeMarker, or type DeMarker in its search.
- Its settings: the settings card opens when it is added; its legend's name opens it again.
18From an agent or a program
Two tools reach it. study_values computes it over a workbench’s candles up to the clock — no chart needed — and study_attach puts it on a chart, where it is drawn and saved with the chart ({"chart": "<chart uri>", "kind": "demarker"}).
The study, as a chart files it
This is a new DeMarker’s entry — its kind, its calculation, the price it reads and its settings. Change a setting here to read it with other inputs.
{
"applied": "close",
"convention": "mt5",
"kind": "demarker",
"settings": {
"period": 14,
"shape": "period"
}
}An agent
An agent calls the MCP tool with it:
{
"name": "study_values",
"arguments": {
"bench": "bentrix://lab/\u2026/bench/\u2026",
"symbol": "EURUSD",
"timeframe": "H1",
"limit": 5,
"study": {
"applied": "close",
"convention": "mt5",
"kind": "demarker",
"settings": {
"period": 14,
"shape": "period"
}
}
}
}A program
A program does the same in its language — bench and market as in the built-in indicators guide:
Python
values = client.study.values(bench, market, "H1", {"applied": "close", "convention": "mt5", "kind": "demarker", "settings": {"period": 14, "shape": "period"}}, limit=5)
print("times:", values["times"])
for line in values["lines"]:
print("line:", line["line"])
print(" newest values:", line["values"])JavaScript
const values = await client.study.values({ bench, symbol: market, timeframe: "H1", study: { "applied": "close", "convention": "mt5", "kind": "demarker", "settings": { "period": 14, "shape": "period" } }, limit: 5 });
console.log("times:", values.times);
for (const line of values.lines) {
console.log("line:", line.line);
console.log(" newest values:", line.values);
}C#
var values = await client.Study.Values(bench, market, "H1", new Dictionary<string, object?> { ["applied"] = "close", ["convention"] = "mt5", ["kind"] = "demarker", ["settings"] = new Dictionary<string, object?> { ["period"] = 14, ["shape"] = "period" } }, limit: 5);
Console.WriteLine($"times: {values!["times"]!}");
foreach (var line in values!["lines"]!.AsArray())
{
Console.WriteLine($"line: {line!["line"]!}");
Console.WriteLine($" newest values: {line!["values"]!}");
}Go
values := must(client.Study.Values(ctx, mcp.StudyValuesArgs{Bench: bench, Symbol: market, Timeframe: "H1", Study: map[string]any{"applied": "close", "convention": "mt5", "kind": "demarker", "settings": map[string]any{"period": 14, "shape": "period"}}, Limit: mcp.Ptr[int64](5)}))
fmt.Println("times:", at(values, "times"))
for _, line := range at(values, "lines").([]any) {
fmt.Println("line:", at(line, "line"))
fmt.Println(" newest values:", at(line, "values"))
}Java
Object values = client.study.values(new Bentrix.StudyApi.ValuesArgs(bench, market, "H1", obj("applied", "close", "convention", "mt5", "kind", "demarker", "settings", obj("period", 14, "shape", "period"))).limit(5L));
System.out.println("times:" + " " + at(values, "times"));
for (Object line : (List<Object>) at(values, "lines")) {
System.out.println("line:" + " " + at(line, "line"));
System.out.println(" newest values:" + " " + at(line, "values"));
}C++
auto values = client.study.values_(StudyApi::ValuesArgs(bench, market, "H1", Json::Object{{"applied", "close"}, {"convention", "mt5"}, {"kind", "demarker"}, {"settings", Json::Object{{"period", 14}, {"shape", "period"}}}}).limit(5));
std::cout << "times:" << " " << values["times"].dump() << std::endl;
for (const Json &line : values["lines"].arr()) {
std::cout << "line:" << " " << line["line"].dump() << std::endl;
std::cout << " newest values:" << " " << line["values"].dump() << std::endl;
}Julia
values = client.study.values(bench, market, "H1", Dict{String,Any}("applied" => "close", "convention" => "mt5", "kind" => "demarker", "settings" => Dict{String,Any}("period" => 14, "shape" => "period")); limit = 5)
println("times:", " ", values["times"])
for line in values["lines"]
println("line:", " ", line["line"])
println(" newest values:", " ", line["values"])
endR
values <- client$study$values(bench, market, "H1", list(applied = "close", convention = "mt5", kind = "demarker", settings = list(period = 14, shape = "period")), limit = 5)
cat("times:", format(values$times), "\n")
for (line in values$lines) {
cat("line:", format(line$line), "\n")
cat(" newest values:", format(line$values), "\n")
}Rust
let values = client.study().values(mcp::StudyValuesArgs::new(bench.clone(), market.clone(), "H1", serde_json::json!({"applied": "close", "convention": "mt5", "kind": "demarker", "settings": {"period": 14, "shape": "period"}})).limit(5))?;
println!("times: {}", values["times"]);
for line in values["lines"].as_array().into_iter().flatten() {
println!("line: {}", line["line"]);
println!(" newest values: {}", line["values"]);
}Reading the answer
times— the candles’ open times, in milliseconds since 1970 (UTC), oldest first.lines— one entry per line, in this order, each with itslinename and itsvalues;values[i]belongs to the candle attimes[i].- The last value is the candle at the clock’s, which may still be forming: it changes until that candle closes, as on the chart. Nothing after the clock is ever computed.
nullis a candle with no value yet — the warm-up, about 1 × the period at the start of the history.- Its fixed levels, drawn on the chart:
[0.3, 0.7].
line | What it is |
|---|---|
Main | the indicator's own value |
In a strategy
Filed under a key of your choice in a strategy document’s studies — here demarker: {"demarker": {"applied": "close", "convention": "mt5", "kind": "demarker", "settings": {"period": 14, "shape": "period"}}} — its rules can name:
| Write | What it is |
|---|---|
demarker | its main line, as a value in a compare |
{"cond": "demarker:level.cross_up:0.3"} | a condition it declares itself |
{"cond": "demarker:level.cross_down:0.3"} | a condition it declares itself |
{"cond": "demarker:level.above:0.3"} | a condition it declares itself |
{"cond": "demarker:level.below:0.3"} | a condition it declares itself |
{"cond": "demarker:level.cross_up:0.7"} | a condition it declares itself |
{"cond": "demarker:level.cross_down:0.7"} | a condition it declares itself |
{"cond": "demarker:level.above:0.7"} | a condition it declares itself |
{"cond": "demarker:level.below:0.7"} | a condition it declares itself |
19Sources
- DeMark, Thomas R. The New Science of Technical Analysis. Wiley, 1994.
Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed