Balance of Power
Close minus open divided by high minus low, per bar, from −1 to +1.
It measures which side finished the bar in control, on a scale where the bar's own range is the unit. It is unsmoothed and one bar wide, so it is noisy by construction; readings are usually taken from its sign and from an average of it rather than from single bars.
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, and Balance of Power has a value from the first. Its line runs between -0.9945 and 0.9840 on these bars, and the last value is -0.1382. The pane's scale is fixed at -1 to 1, the range the study can take. Counting the conditions the study declares on these bars: crosses above 0 71 times; crosses below 0 71 times. Press a condition under the figure to see each place marked. As states rather than moments: is above 0 on 147 bars; is below 0 on 153 bars.
02Its parts, named
03What you see
A value per bar between −1 and +1 in its own pane, usually smoothed: near +1 when the bar closed near its high after opening near its low, near −1 for the reverse, near zero when it closed where it opened.
04Where it comes from
Igor Livshin described the Balance of Market Power in Technical Analysis of Stocks & Commodities (August 2001) as a way to see, bar by bar, whether buyers or sellers carried the price from open to close.
05The formula
BOP = (C − O)/(H − L)
Many charts, Bentrix's included, can smooth it with a moving average; on its own it is very noisy.
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.
The last bar opened at 24, reached 27, fell to 23 and closed at 26.
BOP = (26 − 24) / (27 − 23) = 0.50
The bar gained 2 from open to close inside a range of 4: half of its range was net progress. The bar before opened at 25 and closed at 24 within 23–26: (24 − 25) / (26 − 23) = -0.33.
From one bar to the next the value went from -0.33 to 0.50. That is how the raw line behaves on every chart — it has no memory at all.
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("Balance of Power") barRange = high - low // How far the bar moved from open to close, against its whole range. bop = barRange <= 0 ? 0.0 : (close - open) / barRange plot(bop, "BOP")
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
Sign. Positive values are read as closes ending above opens; a run of them as bars consistently finishing higher than they began.
Size. Values near ±1 are read as bars that travelled their whole range in one direction.
Against price. A rising price with a smoothed BOP falling toward zero is read as the bars' bodies shrinking.
How the sign fails. It says only where the close is relative to the open of the same bar. A market can fall for days through gaps while most bars close above their opens.
09In different markets and timeframes
The raw Balance of Power changes sign nearly every bar and is unreadable on any timeframe without smoothing. Smoothed over 14 bars it behaves like a slow body-based oscillator.
It is built from each bar's open, high, low and close, so it needs bars whose open is a real event. On a market with a daily session it compares where trading began and ended that day; on a continuous market the open is the last close and the number shrinks toward the bar's own change over its range. In a trend the smoothed line stays on one side of zero for long stretches; in a range it oscillates around it. Bars with almost no range — holidays, the quietest minutes — give extreme values from tiny moves.
10With other studies
Read under a moving average of itself (Livshin smoothed it with a 14-bar average), and beside Qstick and the IMI, which measure the same open-to-close behaviour.
11What it does not tell you
It is a ratio within each bar. It ignores the gap between bars and the size of the bar: a tiny bar and a huge one with the same shape read the same.
12Inputs and defaults
- 1Timeframe — ChartThe chart's own by default; any higher one, read on the last closed candle. A finer one is never offered.
- 2Wait for the candle to close — OnThe value of a higher timeframe is taken only from a candle that has finished.
What each input changes
- TimeframeThe study has no numeric input: each value is made from one bar alone. The bar's length is therefore the only thing that changes it.
- In useIt has no input of its own; the smoothing applied to it is the choice — 14 bars is the author's.
13Limits and common misreadings
A zero range. When the high equals the low the ratio is undefined; such bars are left out.
Unsmoothed, it is noise. Read the smoothed line, and compare its level with its own history.
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
Attach BOP smoothed over 14 bars on an M15 replay. Find a stretch where price rose but the line fell, and look at the bars' bodies in that stretch.
Open the laboratory17In Bentrix
- From the menu: a chart's Indicators button › Oscillators › Balance of Power, or type Balance of Power 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": "bop"}).
The study, as a chart files it
This is a new Balance of Power’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": "talib",
"kind": "bop",
"settings": {
"shape": "none"
}
}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": "talib",
"kind": "bop",
"settings": {
"shape": "none"
}
}
}
}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": "talib", "kind": "bop", "settings": {"shape": "none"}}, 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": "talib", "kind": "bop", "settings": { "shape": "none" } }, 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"] = "talib", ["kind"] = "bop", ["settings"] = new Dictionary<string, object?> { ["shape"] = "none" } }, 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": "talib", "kind": "bop", "settings": map[string]any{"shape": "none"}}, 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", "talib", "kind", "bop", "settings", obj("shape", "none"))).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", "talib"}, {"kind", "bop"}, {"settings", Json::Object{{"shape", "none"}}}}).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" => "talib", "kind" => "bop", "settings" => Dict{String,Any}("shape" => "none")); 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 = "talib", kind = "bop", settings = list(shape = "none")), 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": "talib", "kind": "bop", "settings": {"shape": "none"}})).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.0].
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 bop: {"bop": {"applied": "close", "convention": "talib", "kind": "bop", "settings": {"shape": "none"}}} — its rules can name:
| Write | What it is |
|---|---|
bop | its main line, as a value in a compare |
{"cond": "bop:level.cross_up:0"} | a condition it declares itself |
{"cond": "bop:level.cross_down:0"} | a condition it declares itself |
{"cond": "bop:level.above:0"} | a condition it declares itself |
{"cond": "bop:level.below:0"} | a condition it declares itself |
19Sources
- Livshin, Igor. "Balance of Market Power." Technical Analysis of Stocks & Commodities, August 2001.
Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed