Skip to content

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 ​

FieldValue
FamilyPrice Statistics
Input typeCandle
Output typef64
Output range[−1, +1]
Default parametersnone (stateless per-bar transform)
Warmup period1
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:

rust
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/3 for the test bar); pinned by upper_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 by symmetric_wicks_are_zero.
  • Zero-range bar. high == low yields 0; pinned by zero_range_bar_yields_zero.
  • Bounds. Output is always in [−1, 1] (since |upper − lower| <= range); pinned by stays_within_unit_range.

Examples ​

Rust ​

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 ​

python
import wickra as ta

wr = ta.WickRatio()
print(wr.batch([10.0], [13.0], [10.0], [10.5]))

Output:

[0.83333333]

Node ​

javascript
const ta = require('wickra');
const wr = new ta.WickRatio();
console.log(wr.update(10, 13, 10, 10.5));

Output:

0.8333333333333334

Interpretation ​

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):

IndicatorFormulaUp barMirrored down bar
BodySizePct|close − open| / (high − low)0.5330.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 ​