Candle Wick Ratio
The signed imbalance between the upper and lower shadows as a fraction of the bar range — the rejection asymmetry of a candle.
Quick reference
| Field | Value |
|---|---|
| Family | Price Statistics |
| Input type | Candle |
| Output type | f64 |
| Output range | [−1, +1] |
| Default parameters | none (stateless per-bar transform) |
| Warmup period | 1 |
| Interpretation | +1 all upper shadow (shooting-star); −1 all lower shadow (hammer); 0 symmetric / wickless. |
Formula
upper_wick = high − max(open, close)
lower_wick = min(open, close) − low
WickRatio = (upper_wick − lower_wick) / (high − low)Where BodySizePct measures how much of the range is body, this measures which side the wicks fall on — the rejection asymmetry many reversal setups depend on. A zero-range bar yields 0.
Source: crates/wickra-core/src/indicators/wick_ratio.rs.
Parameters
None. The constructor is WickRatio::new().
Inputs / Outputs
From crates/wickra-core/src/indicators/wick_ratio.rs:
use wickra::{Candle, Indicator, WickRatio};
// WickRatio: Input = Candle, Output = f64
const _: fn(&mut WickRatio, Candle) -> Option<f64> = <WickRatio as Indicator>::update;Node update(open, high, low, close) / batch(open[], high[], low[], close[]); Python update(candle) / batch(open, high, low, close) → array.array('d').
Warmup
warmup_period() == 1; the unit test emits_from_first_candle pins it.
Edge cases
- Upper-shadow dominance. A long upper wick gives a positive reading (
+2.5/3for the test bar); pinned byupper_shadow_dominates_is_positive. - Lower-shadow dominance. A hammer gives a negative reading; pinned by
lower_shadow_dominates_is_negative. - Symmetric wicks. Equal shadows give
0; pinned bysymmetric_wicks_are_zero. - Zero-range bar.
high == lowyields0; pinned byzero_range_bar_yields_zero. - Bounds. Output is always in
[−1, 1](since|upper − lower| <= range); pinned bystays_within_unit_range.
Examples
Rust
use wickra::{Candle, Indicator, WickRatio};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut wr = WickRatio::new();
// upper 13 - 10.5 = 2.5, lower 10 - 10 = 0, range 3 -> +0.8333.
let c = Candle::new(10.0, 13.0, 10.0, 10.5, 10.0, 0)?;
println!("{:?}", wr.update(c));
Ok(())
}Output:
Some(0.8333333333333334)Python
import wickra as ta
wr = ta.WickRatio()
print(wr.batch([10.0], [13.0], [10.0], [10.5]))Output:
[0.83333333]Node
const ta = require('wickra');
const wr = new ta.WickRatio();
console.log(wr.update(10, 13, 10, 10.5));Output:
0.8333333333333334Interpretation
WickRatio captures intrabar rejection: a strongly positive reading is a long upper shadow (sellers rejected higher prices — shooting-star geometry), a strongly negative reading a long lower shadow (buyers rejected lower prices — hammer geometry). Combine with BodySizePct (a small body plus a one-sided wick is the canonical pin-bar) to build reversal filters.
Common pitfalls
- Not a pattern detector. This is a continuous geometry feature, not a yes/no pattern — threshold it yourself, or use the dedicated candlestick pattern indicators (e.g. Indicator-Hammer).
References
Candlestick shadow / rejection geometry; Nison (1991).
How it differs from BodySizePct and Balance of Power
Take one bar, open 100, high 110, low 95, close 108 (range 15), and its mirror image with open and close swapped (open 108, close 100):
| Indicator | Formula | Up bar | Mirrored down bar |
|---|---|---|---|
| BodySizePct | |close − open| / (high − low) | 0.533 | 0.533 |
| BalanceOfPower | (close − open) / (high − low) | +0.533 | −0.533 |
| WickRatio | (upper wick − lower wick) / (high − low) | −0.200 | −0.200 |
WickRatio is the only one of the three that reads the shadows. A long lower shadow — price pushed down and bought back — drives it negative, a long upper shadow positive, and the body's colour plays no part: both bars above score −0.2. BodySizePct measures the body's share of the range (unsigned, 0.533 on both bars) and Balance of Power the same share with the direction kept.
A hammer and a hanging man have the same WickRatio; a strong trend bar with no shadows scores 0 here and close to 1 on BodySizePct. Combine the two to tell a rejection bar (large |WickRatio|, small body) from a conviction bar (small |WickRatio|, large body).
See also
- Indicator-BodySizePct — body fill.
- Indicator-Hammer — a dedicated lower-shadow pattern.
- Indicators-Overview — the full taxonomy.