Intermediate Trading Tutorial | MultiCharts PowerLanguage
Why normalize close displacement?
A large candle is not necessarily a large change in the closing price. A market can travel far intrabar and finish near its previous close. This indicator measures the absolute change between consecutive closes relative to the average high-low range of earlier bars. It separates closing displacement from intrabar activity without assuming that either predicts the next move.
Calculation and worked example
CDR = absolute value of (current close minus previous close) divided by the mean high-low range of the preceding N bars. The default lookback is 20. Excluding the signal bar prevents an unusually wide current candle from immediately raising its own comparison baseline. Suppose the prior average range is 4 points. Four independent hypothetical observations have close changes of 2, 4, 6 and 0 points; their ratios are 0.5, 1.0, 1.5 and 0.0 respectively. The reference line at 1 represents one historical average range, not a probability or a standard deviation.

Figure 1. Four independent hypothetical observations using the same baseline; green highlights displacement above the reference.
Complete indicator source
Inputs: Lookback(20);
Variables: BaseRange(0), Ratio(0), N(0);
{ Evaluate completed bars only. }
N = MaxList(1, IntPortion(Lookback));
If BarStatus(1) = 2 and CurrentBar > N then begin
{ Exclude the signal bar from the baseline. }
BaseRange = Average(High - Low, N)[1];
If BaseRange > 0 then begin
Ratio = AbsValue(Close - Close[1]) / BaseRange;
Plot1(Ratio, "CDR");
Plot2(1, "Ref");
If Ratio >= 1 then
SetPlotColor(1, Green)
else
SetPlotColor(1, Blue);
end
else NoPlot(1);
end;
Use a separate indicator pane. The ratio is dimensionless and nonnegative. A zero baseline suppresses the ratio rather than dividing by zero. The lookback is truncated to an integer and constrained to at least one. The warm-up guard is deliberately conservative; set Maximum Bars Back to at least N+1 or use automatic detection and verify that it covers the chosen input.
Installation and closed-bar behavior
Open PowerLanguage Editor, create a new Indicator named Close Displacement Ratio, paste the code, compile, then insert the indicator into a chart. Use a single data series and disable intrabar indicator updating if you want a strictly close-driven display. BarStatus(1)=2 restricts the calculation to the closing update of Data1. The currently forming bar may have no plotted value. No future references are used; finalized values should remain stable with unchanged historical data and settings. Data corrections, session changes and non-time-based bar reconstruction can alter historical results.
Testing and interpretation
Start with a liquid instrument and a fixed time interval. Manually calculate the prior twenty high-low ranges and compare the average against the plotted value. Verify that a close change of zero produces zero even if the candle has a long wick. Check gaps, flat markets, session boundaries and changes in lookback. A gap can produce a high ratio because the numerator includes the gap while the denominator uses high-low ranges rather than true range. This is intentional, but a true-range variant may suit instruments with frequent gaps. Compare values only under consistent session templates and bar construction. A high ratio is not inherently bullish or bearish: direction is discarded. If a directional filter is needed, keep it separate so that magnitude and direction remain interpretable.
For a custom signed version, session reset or alert integration, contact Custom MultiCharts indicator Development Services.
Risk disclosure
This educational indicator is not a trading system or investment recommendation. Thresholds are illustrative and have not been optimized. The source has not been compiled or tested in MultiCharts in this session. Verify it independently before use; trading can result in substantial losses.