Methodology
Algorithm version 1. Every number on this page is read from the configuration the engine runs with.
Educational purposes only. Not financial advice. Past performance does not guarantee future results.
1. Data
Candles come from Binance's public market data for the top USDT spot pairs by 24-hour volume (refreshed weekly; coins that leave the list keep their history). Stablecoins, leveraged tokens and tokenised stocks are excluded. Timeframes are 15 minutes, 1 hour, 4 hours and 1 day, each fetched directly from the exchange rather than built from smaller candles. History starts in 2020 or at the listing date. All times are UTC.
Missing candles are detected and fetched again automatically. Candles with impossible values (for example a high below the low) are flagged and skipped by the detector.
2. Why nothing here repaints
"Repainting" means a chart pattern, indicator or label that changes after the fact, so that the history looks better than it was in real time. ClosedCandle is built so that this cannot happen:
- Closed candles only. The detector processes candles one by one, oldest first, and only after they have closed. A decision made at candle t uses candles up to t and nothing after it.
- Stored once, never edited. A detection is written with the time it appeared and is never modified or deleted. Only its later status (confirmed or invalidated, written once) and the measured outcome are filled in. This is enforced in the application and by database triggers.
- Swing points are confirmed with a delay. A high or low only counts once later candles have moved away from it, and that delay is recorded for each pivot.
- Reproducible. Running the detector again over the same candles gives identical results, whether in one pass or resumed in pieces. Automated tests check this, and also check that changing candles after time t leaves everything decided at t unchanged.
- Live and historical are kept apart. Detections written as the candle closed are marked live; those reconstructed from history when a coin was first loaded are marked historical. The track record can be filtered to live detections only.
- No hindsight filtering. A structure that has already broken out by the time it becomes visible is not recorded as a setup, because nobody could have seen it forming.
3. Swing points
Volatility is measured with the 14-period Average True Range (Wilder smoothing). A swing high is confirmed when a closed candle's close is at least 1.5× ATR below the highest high since the last swing low (and the mirror for swing lows). So a pivot is always known a few candles after it formed; the exact number varies and is stored with it.
4. Pattern definitions
Double Top
- Two swing pivots (from the 1.5× ATR zigzag) at nearly the same price: the second may differ from the first by at most 0.5× ATR.
- The two pivots are 8–120 candles apart, the swing between them is at least 1× ATR deep, and price must have entered the pattern from the far side of that swing.
- The neckline is the horizontal level of that middle swing. The pattern is recorded as soon as the second pivot is confirmed by a closed candle.
- Confirmed when a candle closes beyond the neckline; invalidated when a candle closes beyond the more extreme of the two pivots (also the measured stop), or after 30 candles without a breakout.
Double Bottom
- Two swing pivots (from the 1.5× ATR zigzag) at nearly the same price: the second may differ from the first by at most 0.5× ATR.
- The two pivots are 8–120 candles apart, the swing between them is at least 1× ATR deep, and price must have entered the pattern from the far side of that swing.
- The neckline is the horizontal level of that middle swing. The pattern is recorded as soon as the second pivot is confirmed by a closed candle.
- Confirmed when a candle closes beyond the neckline; invalidated when a candle closes beyond the more extreme of the two pivots (also the measured stop), or after 30 candles without a breakout.
Ascending Triangle
- Built from the last 4–6 confirmed swing pivots, with at least 2 touches on each side.
- Each side is a least-squares line through its pivots; every pivot must sit within 0.5× ATR of its line.
- The upper line is flat (it moves less than 0.6× ATR over the pattern) and the lower line rises.
- The lines must converge: the width at the last pivot is at least 20% narrower than at the first, and the pattern spans at most 150 candles.
- Confirmed when a candle closes beyond the breakout line; invalidated by a close beyond the opposite line, or after 30 candles (sooner if the lines meet first). The measured stop is the last pivot on the opposite side.
Descending Triangle
- Built from the last 4–6 confirmed swing pivots, with at least 2 touches on each side.
- Each side is a least-squares line through its pivots; every pivot must sit within 0.5× ATR of its line.
- The lower line is flat (it moves less than 0.6× ATR over the pattern) and the upper line falls.
- The lines must converge: the width at the last pivot is at least 20% narrower than at the first, and the pattern spans at most 150 candles.
- Confirmed when a candle closes beyond the breakout line; invalidated by a close beyond the opposite line, or after 30 candles (sooner if the lines meet first). The measured stop is the last pivot on the opposite side.
Symmetrical Triangle
- Built from the last 4–6 confirmed swing pivots, with at least 2 touches on each side.
- Each side is a least-squares line through its pivots; every pivot must sit within 0.5× ATR of its line.
- The upper line falls and the lower line rises. The expected direction is the direction of the swing leading into the first pivot.
- The lines must converge: the width at the last pivot is at least 20% narrower than at the first, and the pattern spans at most 150 candles.
- Confirmed when a candle closes beyond the breakout line; invalidated by a close beyond the opposite line, or after 30 candles (sooner if the lines meet first). The measured stop is the last pivot on the opposite side.
Bull Flag
- Pole: a upward move of at least 3× ATR from its starting extreme to its end extreme, completed within 15 candles.
- Flag: the 5–20 candles after the pole end. Their closes must drift sideways or downward (regression slope), no steeper than 50% of the pole slope, and retrace at most 50% of the pole.
- The channel lines are regressions of the flag highs and lows, shifted outward so every flag candle sits inside. The invalidation level (and measured stop) is the 50% retracement of the pole.
- Confirmed by a close beyond the channel line on the pole side; invalidated by a close beyond the retracement level, or after 15 candles.
Bear Flag
- Pole: a downward move of at least 3× ATR from its starting extreme to its end extreme, completed within 15 candles.
- Flag: the 5–20 candles after the pole end. Their closes must drift sideways or upward (regression slope), no steeper than 50% of the pole slope, and retrace at most 50% of the pole.
- The channel lines are regressions of the flag highs and lows, shifted outward so every flag candle sits inside. The invalidation level (and measured stop) is the 50% retracement of the pole.
- Confirmed by a close beyond the channel line on the pole side; invalidated by a close beyond the retracement level, or after 15 candles.
Rising Wedge
- Built from the last 4–6 confirmed swing pivots, with at least 2 touches on each side, each within 0.5× ATR of its regression line.
- Both lines slope upward (neither is flat within 0.6× ATR over the pattern) and they converge by at least 20%.
- Confirmed by a close beyond the breakout line; invalidated by a close beyond the other line, or after 30 candles (sooner if the lines meet first). The measured stop is the last pivot on the opposite side.
Falling Wedge
- Built from the last 4–6 confirmed swing pivots, with at least 2 touches on each side, each within 0.5× ATR of its regression line.
- Both lines slope downward (neither is flat within 0.6× ATR over the pattern) and they converge by at least 20%.
- Confirmed by a close beyond the breakout line; invalidated by a close beyond the other line, or after 30 candles (sooner if the lines meet first). The measured stop is the last pivot on the opposite side.
Head and Shoulders
- Five consecutive confirmed swing pivots: shoulder, neckline point, head, neckline point, shoulder. The swing before the left shoulder must start beyond both neckline points.
- The head is at least 0.5× ATR higher than both shoulders, and the two shoulders are within 1× ATR of each other.
- The neckline joins the two swing lows between the peaks; the pattern spans at most 200 candles.
- Confirmed when a candle closes beyond the neckline; invalidated by a close beyond the right shoulder (also the measured stop), or after 30 candles.
Inverse Head and Shoulders
- Five consecutive confirmed swing pivots: shoulder, neckline point, head, neckline point, shoulder. The swing before the left shoulder must start beyond both neckline points.
- The head is at least 0.5× ATR lower than both shoulders, and the two shoulders are within 1× ATR of each other.
- The neckline joins the two swing highs between the troughs; the pattern spans at most 200 candles.
- Confirmed when a candle closes beyond the neckline; invalidated by a close beyond the right shoulder (also the measured stop), or after 30 candles.
5. Forming, confirmed, invalidated
- Forming: the structure exists and nothing has broken yet.
- Confirmed: a candle closed beyond the breakout line. A wick through the line is not enough. Only the first breakout counts.
- Invalidated: a candle closed beyond the invalidation side first, or the pattern expired without a breakout.
6. Quality score (0–100)
Quality = 40% geometric fit + 30% size + 30% clarity, each part scaled to 0–1:
- Fit: how close the pivots are to the pattern's lines or levels, relative to the allowed tolerance.
- Size: the pattern height measured in ATRs (larger structures score higher, capped).
- Clarity: a pattern-specific measure, such as depth between double tops, number of touches in a triangle, or how little a flag retraced.
The score describes how textbook the shape is. It is not a probability, and higher scores are not claimed to perform better; the track record shows what actually happened.
7. How each setup is measured
Every confirmed pattern is measured with the same fixed rules, decided before the outcome is known:
- Entry: the open of the candle after the breakout candle closes.
- Stop: the pattern's invalidation side (see each definition above).
- Target: the measured move: the pattern height projected from the breakout level.
- If the stop and the target are both touched within the same candle, the result counts as a stop (we cannot know which came first).
- If price gaps through the stop or target, the exit is filled at the open of that candle, not at the level.
- Time limit: if neither is reached, the setup is closed at the close of the candle 3× the pattern length after entry (minimum 10, maximum 600 candles).
- If the entry candle already opens beyond the stop, the setup is skipped (marked, not measured).
- Costs: 0.1% taker fee + 0.05% slippage on each side (0.15% in, 0.15% out), deducted from every result. There is no cost-free view anywhere on the site.
- Results are in R: profit or loss divided by the risk between entry and stop. A full stop is about −1 R before costs.
- MFE / MAE: the most favourable and most adverse move before the exit, in R.
All of this is calculated with exact decimal arithmetic, not floating point.
8. Statistics
For each pattern × timeframe × coin, and combined: number of detections, confirmations and measured setups, share that reached the target, average and median R after costs, profit factor (gross wins ÷ gross losses), and average MFE / MAE. With fewer than 30 measured setups a figure shows "Insufficient data" instead of a number. Statistics are recomputed every 30 minutes by a background job, never on page view.
9. Algorithm versions
Any change to a rule or parameter creates a new algorithm version. Detections from older versions are kept unchanged, and statistics are always shown per version, so a rule change can never rewrite the past.