TradeViora AcademyLearn. Analyze. Practice. Trade Smarter.
Menu

FREE FINANCIAL EDUCATION

An out-of-sample candle study: freeze the detector before evaluation

Study an out-of-sample candle study: freeze the detector before evaluation through mechanisms, a synthetic worked case, practice, and explained assessment.

Candlestick Analysis

APPLIED STUDY · ORIGINAL LESSON

Learning plan and prerequisites

Before you begin: Complete candle pattern base rates and overlapping labels, and understand a fixed outcome horizon and R-multiple trade accounting.

Mechanism and interpretation

A reproducible candle study specifies the detector before evaluating it on later data. Its specification includes body and shadow tolerances, trend context, aggregation, data revisions, event deduplication, future outcome horizon and any execution model. Testing several doji ceilings and retaining the best result is a selection step. It is not an unbiased evaluation of the selected ceiling, even if every arithmetic calculation is correct.

Use earlier data for development, another earlier segment for deliberate calibration, and reserve later observations for a frozen final evaluation. Record every tried variant. If the final result prompts a rule change, that segment becomes part of development and a further untouched segment is needed for another evaluation. Also examine labels near chronological boundaries: a training example can use only past features yet still leak evaluation-period information through a future-return target. Remove training origins whose target windows enter the evaluation period. Historical feature lookbacks that end before a signal are a different issue from future target windows.

Worked case — synthetic data

In a synthetic design, the first 400 observations support development and the next 200 support calibration. After those stages, a 5% inclusive body-to-range doji rule and all other settings are frozen. A final 300-observation evaluation contains only eligible endpoints with fully observed outcome horizons. Forty endpoints satisfy the frozen detector; 22 have positive outcomes. Of 260 non-pattern endpoints, 143 have positive outcomes. Both fractions are 55%, so observed lift over the non-pattern baseline is zero percentage points.

In a separate, explicitly specified toy trade ledger for the 40 signals, 22 trades gain 1R and 18 lose 1.2R before a flat 0.06R cost on each trade. Gross result is 22R-21.6R = 0.4R. Costs total 2.4R, giving net -2R and mean -0.05R per trade. These invented outcomes show why a directional hit fraction and net trading result are different quantities. They are not evidence of actual performance.

Context and failure modes

For a boundary illustration, suppose training origins are indexed 0 through 399, evaluation starts at 400, and each training outcome ends three bars after its origin. Origins 397, 398 and 399 have outcome endpoints at 400 or later and must be excluded from training under a strict non-overlap rule. Origin 396 ends at 399 and remains eligible. Purging prevents this specific overlap; it does not guarantee stationarity or remove dependence among all evaluation observations.

Practice task

Training origins are 0 through 199, evaluation begins at 200 and the outcome horizon is five bars. Identify the origins to purge and the latest retained origin. A frozen-rule ledger then records 25 trades: 14 win 1R, 11 lose 1R and each incurs 0.08R cost. Compute net total, mean net R and win fraction.

Worked practice answer

Purge origins 195 through 199 because their endpoints reach 200 through 204. Origin 194 ends at 199 and is the latest retained origin. Gross trade result is 14R-11R = 3R; costs are 25 times 0.08R = 2R. Net result is 1R, mean net is 0.04R per trade and win fraction is 14/25 = 56%. This arithmetic remains a synthetic example, not a profitability forecast.

Topic assessment

Choose an answer before opening each explanation. These questions test the specific mechanism in this lesson.

1. What happens if the final evaluation is used to choose a new doji ceiling?

  1. The new ceiling is automatically validated
  2. Costs can be omitted thereafter
  3. It becomes part of development rather than remaining untouched evaluation
Reveal answer and explanation

C. Rule selection uses information from that segment, so a later independent evaluation is still needed.

2. Which main boundary origin is the last retained one?

  1. 396
  2. 397
  3. 399
Reveal answer and explanation

A. Origin 396 has target endpoint 399; origin 397 reaches the evaluation start at 400.

3. What is the main toy ledger's net result?

  1. Plus 22R
  2. Minus 2R
  3. Plus 0.4R
Reveal answer and explanation

B. The 0.4R gross result minus 2.4R of costs gives a negative 2R net result.

Primary references and scope

Original explanation and synthetic calculations. Chart thresholds are explicit research conventions, not exchange rules or proof of predictive ability.