Replace an absolute volatility threshold with a historical rank
A four-point signal candle may be unusually large in a quiet market but ordinary in a volatile market. Instead of a fixed minimum range or a normal-distribution assumption, this MultiCharts .NET long-entry design compares the signal bar's range with an empirical rolling percentile. It tests whether breakouts accompanied by unusually large ranges behave differently from an unfiltered baseline.
Define the reference before the signal
Sort the high-low ranges of the preceding 100 completed bars, excluding the signal bar. The nearest-rank 80th percentile is the 80th sorted observation (zero-based index 79). Require a positive threshold, a current range at least as large as that threshold, and a close above the highest high of the preceding 20 bars. Ties are accepted. High-low range deliberately ignores gaps, unlike true range.
For a small ten-observation illustration, sorted ranges are 1, 1.5, 2, 2, 2.5, 3, 3, 4, 5 and 6. The eighth value is 4. A signal range of 4.5 passes the range test; 3.5 fails. Both still require the separate close breakout.

Hypothetical ten-bar sample illustrating the same nearest-rank method used with 100 bars in code. Blue marks rank eight.
PowerLanguage .NET implementation
// Members of a SignalObject; bar-close calculation.
private readonly double[] sample = new double[100];
private IOrderMarket entry;
protected override void Create()
{
entry = OrderCreator.MarketNextBar(
new SOrderParameters(Contracts.Default,
"PercentileLong", EOrderAction.Buy));
}
private bool EntrySignal()
{
// Configure MaxBarsBack for 100 prior bars.
double resistance = Bars.High[1];
for (int i = 1; i <= 100; i++)
{
sample[i - 1] = Bars.High[i] - Bars.Low[i];
if (i <= 20)
resistance = Math.Max(resistance, Bars.High[i]);
}
Array.Sort(sample);
double threshold = sample[79]; // nearest rank 80
double range = Bars.High[0] - Bars.Low[0];
return threshold > 0 && range >= threshold &&
Bars.Close[0] > resistance;
}
// In CalcBar(), call EntrySignal() only after
// history is ready; send entry.Send() only after
// flat-position and working-order checks.
Use the platform's SignalObject template with System and the appropriate PowerLanguage namespaces. Configure enough MaxBarsBack, disable intrabar order generation for this example, and reuse the sample array rather than allocating it every bar. The official strategy creation guide and order API reference describe the order creation pattern. The fragment computes the signal and creates an order object, but intentionally leaves actual entry submission to a guarded CalcBar routine. Require a flat strategy position, no pending entry, and explicit order quantity; handle rejection and restart recovery.
Exit model and validation
One controlled experiment uses a protective stop below the signal low and a next-bar market exit when close breaks the prior ten-bar low. Validate tick rounding and stop distance against the actual fill. A next-bar market order need not fill at the signal close. Compare 60th, 80th and 90th percentiles with an unfiltered baseline under identical exit rules and costs. Examine threshold stability after regime changes, sensitivity to outliers, trade count and out-of-sample drawdown. Empirical rank does not measure directional strength and can select exhaustion bars. The fragment has not been compiled or backtested here. Trading and leverage can cause substantial loss.
For custom execution and strategy rules, see Custom MultiCharts .NET strategy Development Services.