MultiCharts .NET Close Location Pressure: A 0–100 Rolling Candle-Control Oscillator in C#
Beginner Trading Tutorial | PowerLanguage .NET | Candlestick mechanics and a measured momentum proxy
Two bullish candles can end at the same price yet convey different information. One may finish close to its high after strong follow-through; another may close in the middle of its range after giving back a large intrabar advance. A simple green/red candle label misses this distinction. This tutorial converts the location of each close inside its own high–low range into a numerical score, then averages multiple completed candles to reveal sustained buying-side or selling-side pressure.
Our custom MultiCharts .NET indicator uses actual PowerLanguage .NET C#—not classic PowerLanguage syntax. It produces a continuous 0–100 oscillator plus two adjustable guide levels. It does not predict a breakout, issue trade orders, or claim that buyers can be directly identified from OHLC alone.
The idea in one candle
For any bar with a nonzero high–low range, define Close Location Value (CLV) as (2 × Close − High − Low) / (High − Low). CLV equals +1 when the bar closes exactly at its high, −1 when it closes at its low, and 0 at the range midpoint. Multiply the translated value by 50 to obtain a convenient single-bar score: 50 × (1 + CLV). The resulting scale runs from 0 to 100.
That is a description of the close's position, not a verdict on market direction. An otherwise bearish candle can close near its high, and a green candle can end well away from its upper extreme. The open is intentionally absent from the formula. For a zero-range bar where high equals low, this implementation assigns neutral CLV = 0 to prevent division by zero.

Why average the last five bars?
The single-bar score can swing sharply on a news candle or a temporary wick. Our rolling pressure score is 50 + 50 × average(CLV of the last N completed bars), with a default N of five. An equivalent calculation averages the single-bar 0–100 scores. This approach is deliberately simple: it gives each bar equal weight rather than assuming that volume is comparable across feeds.
For example, suppose five consecutive CLV values are 0.60, 0.70, 0.80, 0.40, and 0.50. Their average is 0.60, so the rolling score is 50 + 50 × 0.60 = 80. With an UpperZone input of 70, 80 is in the upper pressure zone. If the next bars move lower within their own ranges, that average may fall even while the last traded price remains above the previous session's close. The measure is about repeated close placement, not price performance.

What the inputs really control
| Input | Default | Trade-off |
|---|---|---|
| LookbackBars | 5 | A shorter average reacts faster but is noisier. A longer lookback smooths the profile and delays state changes. |
| UpperZone | 70 | A value at or above 70 means repeated closes favor the upper part of their respective ranges, not guaranteed upside. |
| LowerZone | 30 | A value at or below 30 suggests repeated closes near the lower ends of their ranges. |
The line is colored green above the upper guide, red below the lower guide, and blue in between. These are state labels for research—not buy, sell, stop-loss, or take-profit decisions. On historical bars, values are calculated using that bar and older observations; nothing from subsequent bars is accessed.
Complete PowerLanguage .NET C# source
Create a new C# Indicator in the PowerLanguage .NET Editor and give it the class name shown below. The listing uses the documented IndicatorObject lifecycle, Create(), CalcBar(), [Input] properties, Bars.High[i], Bars.Low[i], Bars.Close[i], and IPlotObject.Set(). All price references are to the current completed bar or older ones. No external dependencies or custom functions are needed.
using System;
using System.Drawing;
using PowerLanguage;
namespace PowerLanguage.Indicator
{
// PowerLanguage .NET indicator; no orders and no future-bar references.
public class PS_CloseLocationPressure : IndicatorObject
{
private IPlotObject pressurePlot;
private IPlotObject upperPlot;
private IPlotObject lowerPlot;
[Input]
public int LookbackBars { get; set; }
[Input]
public double UpperZone { get; set; }
[Input]
public double LowerZone { get; set; }
public PS_CloseLocationPressure(object ctx) : base(ctx)
{
LookbackBars = 5;
UpperZone = 70.0;
LowerZone = 30.0;
}
protected override void Create()
{
pressurePlot = AddPlot(new PlotAttributes(
"CLPressure", EPlotShapes.Line, Color.RoyalBlue));
upperPlot = AddPlot(new PlotAttributes(
"UpperZone", EPlotShapes.Line, Color.ForestGreen));
lowerPlot = AddPlot(new PlotAttributes(
"LowerZone", EPlotShapes.Line, Color.Firebrick));
}
protected override void CalcBar()
{
// Reject unsupported settings without using future data.
if (LookbackBars < 1 || UpperZone > 100.0 ||
LowerZone < 0.0 || LowerZone >= UpperZone)
return;
// Draw only once the chart bar is closed.
if (Bars.Status != EBarState.Close)
return;
// Conservative warm-up before accessing Bars.*[i].
if (Bars.CurrentBar <= LookbackBars)
return;
double sumCLV = 0.0;
for (int i = 0; i < LookbackBars; i++)
{
double high = Bars.High[i];
double low = Bars.Low[i];
double close = Bars.Close[i];
double range = high - low;
// Flat candles are neutral, not division-by-zero.
double clv = (range > 0.0)
? (2.0 * close - high - low) / range
: 0.0;
sumCLV += Math.Max(-1.0, Math.Min(1.0, clv));
}
double score = 50.0 +
50.0 * sumCLV / LookbackBars;
Color stateColor = (score >= UpperZone)
? Color.ForestGreen
: ((score <= LowerZone)
? Color.Firebrick : Color.RoyalBlue);
pressurePlot.Set(score, stateColor);
upperPlot.Set(UpperZone);
lowerPlot.Set(LowerZone);
}
}
}
Code walkthrough: lifecycle, indexing, and plot logic
Constructor: assigns the three defaults when the indicator is instantiated. Create(): allocates three plot objects: the calculated score and two horizontal reference levels. CalcBar(): performs the bar-by-bar work. The program exits on inappropriate parameter combinations, a non-closed bar, or insufficient warm-up history.
The loop runs from i = 0 to i = LookbackBars − 1 and reads price series backwards from the bar currently being calculated. The explicit Bars.Status == EBarState.Close check is an additional safeguard if an operator turns on intrabar updates; the simplest deployment is to leave Update on Every Tick disabled. Once the bar closes, the indicator computes the average CLV and sends the result to pressurePlot.Set(score, stateColor). It draws the upper/lower guides on the same scale.
Warm-up nuance: older bars that lack enough lookback history are left blank rather than filled with fake scores. No histogram of future values is produced. Historical bar corrections and recalculation settings can still change previously stored outputs, so “closed-bar” does not mean guaranteed immutability of the entire data feed.
Install, compare, and validate
- In MultiCharts .NET open the PowerLanguage .NET Editor, create a new Indicator in C#, replace its sample code with the entire listing, and compile with F7.
- Add the indicator from the chart's Insert Study dialog. Place it in a separate subchart if the chart layout offers that option; the score scale is 0–100, not price units.
- Begin with LookbackBars = 5, UpperZone = 70, LowerZone = 30. Use a sufficiently long series to provide warm-up bars.
- Choose a few candles, export or inspect their OHLC values, and independently calculate CLV and the five-bar mean. A bar H=110, L=100, C=108 should produce +0.60 (single-bar score 80).
- Compare lookbacks 5 and 10 across calm and volatile periods; record how the frequency of reaching the 70/30 regions changes. Review early bars and candles with H=L to verify robust handling.
What this oscillator does not know
CLV measures where prices finished inside candle ranges, but does not measure the size of those ranges, true order flow, buyer/seller identity, bid–ask absorption, or net aggressor volume. Five tiny-range closes near their highs can generate a high score without a meaningful absolute price move. Consequently, compare the oscillator with trend structure, volatility and transaction costs before interpreting its output. Session breaks, illiquid assets, data adjustments and synthetic bar types can alter the picture.
Do not optimize the 70/30 guides solely on a handful of successful examples. A sound validation notebook should include both persistent high-score periods that were followed by continuation and periods that quickly reversed. The same applies to low scores. No backtest performance is claimed. This code is intended for an indicator panel and does not contain an order engine, alert, scanner, or risk manager.
If you are interested in extending this free concept—for example, adding custom color zones, multi-timeframe comparisons, alerts or volume-weighted pressure—you can discuss requirements through Custom Trading Software Development Services.
Technical education only. The source is written to documented platform interfaces but has not been compiled in your installed MultiCharts .NET version. Validate indicator behavior, platform settings and market data before relying on it; no investment recommendation or guarantee is implied.