Advanced Trading Tutorial — Volume-Weighted Candle Pressure in Sierra Chart
A close near the high of a candle describes a different price outcome from a close near its low. However, treating every candle equally can obscure the distinction between periods of substantial activity and periods with very little reported volume. This ACSIL tutorial combines close location with volume weighting to produce a bounded descriptive oscillator. It does not measure actual aggressive buying or selling and should not be confused with bid-ask delta.
Calculation
For each completed candle, compute its close location score as (2 × Close − High − Low)/(High − Low). The score is +1 at the high, −1 at the low and zero at the midpoint. A zero-range candle contributes a neutral score. Multiply each score by its reported volume, sum the products over N completed bars, and divide by the sum of their volumes. Ignore nonpositive volume observations. If total volume is zero, return zero by convention. For valid OHLC and nonnegative volume data the result remains between −1 and +1.

Worked example
Suppose three independent candles have highs of 110 and lows of 100, with closes of 109, 103 and 108 and volumes of 100, 200 and 300 respectively. Their scores are +0.8, −0.4 and +0.6. The weighted numerator is 80 − 80 + 180 = 180. Dividing by 600 yields +0.30. The equal-weight average would be approximately +0.3333. The difference arises because the negative observation receives twice the weight of the first positive observation, while the third observation receives the largest weight. These are hypothetical values, not recorded trades.
Complete ACSIL source
The study uses AutoLoop, one subgraph and a configurable integer input. SetDefaults defines the study configuration without performing calculations. During normal calls, sc.Index identifies the current chronological bar. The loop reads the preceding N bars, excluding sc.Index itself. The DataStartIndex setting identifies the earliest valid output. Double-precision accumulators reduce avoidable rounding error during summation.
#include "sierrachart.h"
SCDLLName("PatternSmart Weighted Pressure")
SCSFExport scsf_WeightedCandlePressure(SCStudyInterfaceRef sc)
{
SCSubgraphRef Pressure = sc.Subgraph[0];
SCInputRef Period = sc.Input[0];
if (sc.SetDefaults)
{
sc.GraphName = "Volume Weighted Candle Pressure";
sc.AutoLoop = 1;
sc.GraphRegion = 1;
Pressure.Name = "Pressure";
Pressure.DrawStyle = DRAWSTYLE_LINE;
Pressure.PrimaryColor = RGB(45,105,190);
Pressure.DrawZeros = 1;
Period.Name = "Period";
Period.SetInt(10);
Period.SetIntLimits(1,500);
return;
}
const int n = Period.GetInt();
sc.DataStartIndex = n;
const int t = sc.Index;
if (t < n) return;
double weighted = 0.0, total = 0.0;
// Exclude the forming bar, including during replay.
for (int j = t-n; j < t; ++j)
{
const double range = sc.High[j]-sc.Low[j];
const double volume = sc.Volume[j];
if (volume <= 0.0) continue;
const double score = range > 0.0 ?
(2.0*sc.Close[j]-sc.High[j]-sc.Low[j])/range : 0.0;
weighted += score*volume;
total += volume;
}
// Neutral convention when the window has no volume.
Pressure[t] = total > 0.0 ? weighted/total : 0.0;
}
Installation
Save the source as WeightedCandlePressure.cpp in the ACS_Source folder. In Sierra Chart use Analysis > Build Custom Studies DLL, select the source file and build it using an available supported build method. Add the resulting custom study through Analysis > Studies and the custom study selection interface. Start with Period=10 and use Period=3 for the numerical example. Verify that the chart contains sufficient historical bars and that its volume field is appropriate for the instrument. This source has not been compiled or executed in Sierra Chart here.
Closed-bar alignment and repainting
The value displayed at bar t uses only bars t−N through t−1. The newest observation becomes available when the next bar is recognized, rather than fluctuating with the forming candle. This design avoids future references and intentional repainting of confirmed results. It also means the plot is aligned with information availability rather than the last input bar. Historical corrections, replay reconstruction and changes to the chart's bar type can still change results. A direct loop costs O(N) per calculation; a rolling weighted sum can be considered for larger workloads.
Testing and limitations
Manually verify the example, then test closes at both extremes, midpoint closes, zero-range bars, zero-volume windows and unequal volumes. Observe the output during replay and live updates, and compare it after a full recalculation using identical chart settings. A zero-volume window is indistinguishable from genuinely balanced pressure in this implementation; researchers may prefer a separate validity flag. Reported volume may represent actual traded volume or a feed-specific proxy. A high-volume outlier can dominate the result. The indicator cannot identify trade aggressor side, liquidity or future returns. Consider independent volatility and trend context, and validate any proposed trading rules out of sample with realistic costs.
For custom weighting, validity flags, alerts or automated strategy integration, contact our Custom Sierra Chart indicator Development Services.
Risk disclosure: educational material only. Trading involves risk of loss; hypothetical examples do not establish profitability.