APPLIED STUDY · ORIGINAL LESSON
Learning plan and prerequisites
Before you begin: Know candle anatomy, range-based ratios and the distinction between observed data and a later revised history.
- Validate OHLC ordering before calculating a shape
- Distinguish an implausible-looking observation from a confirmed data error
- Preserve correction timing in a historical signal study
Mechanism and interpretation
An ordinary executed-trade OHLC record must satisfy low no greater than open or close, high no less than open or close, and high no less than low. Its aggregated executed volume cannot be negative. These are internal consistency conditions. They do not determine whether a very large but internally consistent high or low is a genuine transaction, a misreported print, an adjustment issue or another feed problem. Logical validity and economic plausibility are separate review stages.
Inspect timestamps, duplicate records, session alignment, missing intervals, price adjustments and the underlying trade source before classifying candles. A statistical outlier flag is a request for investigation, not permission to rewrite a price. When an authoritative correction exists, retain both versions, the revision reason where available, and the time the correction became available. A reconstruction of what a signal could have known then must use the then-available data. A later cleaned-history study answers a different question and should say so.
Worked case — synthetic data
A synthetic raw candle is O=100, H=140, L=99, C=101. Prior average true range, fixed before this candle, is two. The raw range is 41, or 20.5 times that benchmark. Its body is one, only about 2.44% of the range. Under a stated nonzero-range doji rule with body fraction no greater than 5%, it receives a doji label. It is internally valid OHLC despite its unusual high.
Suppose a documented source revision later removes a misreported high print and sets the high to 102, while open, low and close remain unchanged. Revised range is three and the same one-point body occupies 33.33%, so the doji label no longer qualifies. This conditional correction example does not justify replacing every unusually high print. In contrast, O=100, H=105, L=101, C=104 is logically invalid because its open lies below its reported low; no statistical comparison is needed to identify that inconsistency.
Context and failure modes
A data pipeline should distinguish rejected malformed rows, flagged but retained unusual rows, and confirmed corrected rows. Negative numbers can occur in some financial price series, so a generic assumption that every price must be positive is not the same as an OHLC-ordering check. A signed adjustment message can also differ from ordinary aggregated executed volume. Specify the record type before applying a nonnegative-volume rule. Never delete a candle solely because removing it improves a strategy result.
Practice task
An ordinary candle row reports O=50, H=49.8, L=48, C=49 and executed volume -10. Identify its internal errors. A documented replacement row reports O=50, H=50.2, L=48, C=49 and volume 10. Validate the replacement and calculate its range and body fraction.
Worked practice answer
The original high is below the opening price, and its ordinary aggregated executed volume is negative. These are two separate internal errors. The replacement contains both open and close within [48,50.2] and has nonnegative volume. Range is 2.2, body is one and body fraction is approximately 45.45%. It passes the basic consistency checks but would still need the usual timestamp, session and source checks before use.