High-Wave Candle
Install and import#
npm install fintech-algorithmsimport { highWaveCandle } from "fintech-algorithms/price-action-and-candlesticks/single-candle-patterns/high-wave-candle";Signature#
highWaveCandle(input)Marks each bar with a small body relative to its high-low span whose two shadows are both a multiple of that body, the long-tailed indecision candle.
Parameters#
| Name | Type | Notes |
|---|---|---|
input | TopicInput | bars is a chronologically ordered array of OHLCV rows; each needs a non-empty timestamp strictly greater than the previous row's and finite open, high, low, close and volume. The single-candle family validates body_ratio (default 0.05, within 0..1), shadow_ratio (default 0.35), shadow_body_multiple (default 2, at least 0) and tick_tolerance (default 0.01) on every call. This topic reads body_ratio as the largest body share of the span it will accept and shadow_body_multiple as how many bodies long each shadow must be; a zero body satisfies the shadow test outright. |
Returns#
TopicResult
series.label is "neutral" on a matching bar and "none" otherwise. series.score is body_ratio minus the body share of the span, so it reports headroom on the body test alone and can be at or above zero on a bar the shadow test rejected. latest carries the last value of each. There is no warm-up: both series are populated from the first bar, so ready_at is 0.
Warm-up#
The first 0 bars positions are null. Per-bar geometry with no smoothing state, so ready_at is 0. On a flat bar where high equals low the positive-span guard leaves score null and label at "none", which is a real verdict rather than a warm-up placeholder.
Errors#
- When a bar has a non-finite price or volume, a negative volume, a
highbelow its own open/low/close, alowabove them, or atimestampthat does not advance — throws Error - When
body_ratiois not a finite number or falls outside 0..1, orshadow_body_multipleis not a finite number or is negative — throws Error - When
inputis not an object,input.parametersis not an object, orbarsis not an array holding at least one bar — throws Error
Complexity: time O(n),
space O(n).
Worked example#
executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.
Input#
{
"bars": [
{
"timestamp": "2024-01-02",
"basis": "synthetic-unadjusted",
"open": 100,
"high": 101.45,
"low": 98.695,
"close": 100,
"volume": 750000,
"benchmark": 200
},
{
"timestamp": "2024-01-03",
"basis": "synthetic-unadjusted",
"open": 101.49111452,
"high": 103.38381693,
"low": 100.05480022,
"close": 101.78791214,
"volume": 795117,
"benchmark": 200.56326135
},
{
"timestamp": "2024-01-04",
"basis": "synthetic-unadjusted",
"open": 102.45519048,
"high": 104.6701838,
"low": 100.91147007,
"close": 102.9549389,
"volume": 840234,
"benchmark": 201.11020913
}
],
"parameters": {}
}Call#
highWaveCandle(input)Returns#
object with 9 fields: topic_id, title, state, ready, ready_at, series, latest, parameters, …
{
"topic_id": "D06-F02-A12",
"title": "High-Wave Candle",
"state": "calculated",
"ready": true,
"ready_at": 0,
"series": {
"label": ["neutral", "none", "none", "none", "none", "neutral"],
"score": [
0.05,
-0.03915474022958794,
-0.08295729760191171,
-0.08829149989844472,
-0.0589777590581788,
0.0044297342216514934
]
},
"latest": {
"label": "none",
"score": -0.06921211954649767
},
"parameters": {},
"diagnostics": {
"causal": true,
"input_count": 96
}
}Diagrams#
Calculation flow#
High-Wave Candle calculation flow
flowchart LR
A["one closed OHLC candle, tick size, prior-only reference sc"] --> B["Validate order, basis, and finite values"]
B --> C["Apply the selected High-Wave Candle convention"]
C --> D["Emit value, readiness, and diagnostics"]
D --> E["Interpret descriptively; test outcomes separately"]
B -->|invalid or insufficient| X["Withhold output with a reason"]
High-Wave Candle readiness and evidence states
stateDiagram-v2
[*] --> Waiting
Waiting --> Ready: enough valid causal observations
Waiting --> Rejected: malformed or unsupported input
Ready --> Calculated: selected formula applied
Calculated --> Interpreted: diagnostic and limitation retained
Interpreted --> Ready: next observation arrives
Rejected --> Waiting: corrected input and deterministic reset
How it works#
This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.
References#
- TA-Lib pattern-recognition catalog — see linked primary or authoritative record
- CME Group candlestick chart lesson — see linked primary or authoritative record
- Japanese Candlestick Charting Techniques — see linked primary or authoritative record
- Evidence decision
- Level 1 evidence map