PatternX research · Pre-registered — data not yet analysed
Bull Flag Performance Study
By the PatternX team · Published
Research question
When PatternX's production bull flag detector is replayed over historical candles using only completed bars, what share of its detections reach the measured-move target (one pole height above the breakout) before the flag-low stop within 40 bars, what distribution of net R-multiples follows after costs, and do both differ from matched random long entries with the same stop and target distances?
No results yet. This page publishes the study design before any data is analysed, so the method can’t be adjusted to fit the outcome. Results will appear here — with sample size, period and confidence intervals — once the analysis is complete.
| Markets | Crypto: USDT-margined perpetual futures on Binance (primary set), with Bybit and OKX as replication sets; each venue's 20 most-traded contracts, re-ranked monthly from past volume. Stocks: the 123 US stocks and 67 ETFs on PatternX's curated traditional list, regular-session bars, analysed separately. |
|---|---|
| Timeframes | All eight PatternX timeframes: 1m, 3m, 5m, 15m, 30m, 1h, 4h and 1d. The confirmatory test uses 15m, 1h and 4h; the other five are secondary strata. |
| Period | To be fixed before analysis |
| Sample size | Reported with the results |
| Data source | PatternX's deterministic detectors replayed over historical exchange/broker candles, using the production rules |
Methodology
Fixed before any outcome is computed. Later changes will be listed with their reason and date, and every pre-specified outcome will be reported, null or unfavourable ones included.
- Replay without lookahead. Each series (one instrument on one timeframe) is replayed bar by bar. At bar t, the production BULLISH_FLAG detector receives the 200 most recent bars ending at t, the window the live scanner fetches, and bar t must already be complete. Live scans can act on a bar that is still forming; history cannot reproduce that state, so this study measures the completed-bar form of the rule. Nothing after t is read, and each month's symbol ranking uses only earlier volume.
- Filters. Production filters that candles can reproduce apply unchanged: the breakout candle's close in the trade direction, breakout volume at least 1.2× its 20-bar average, ATR% ≥ 0.05 and the reward:risk floor of 1. Spread, order-book and liquidity-score filters need live data and stay neutral, as in the backtest engine. The PatternX Score is not a filter here, because a replayed score lacks live context.
- Simulation and costs. Entry at the next bar's open plus 0.03% slippage. Stop and target are frozen at detection; exits fill at the level less 0.03%, or at the open when a bar gaps through it, and a bar touching both levels counts as a stop. Fees are 0.05% per side; perpetuals pay 0.01% funding per 8 hours, stocks none. Sensitivity runs double every cost and use the backtest engine's own entry, the signal bar's closing price.
- Control. Each detection is paired with ten random long entries on the same series and calendar month, with the same stop and target distances and a fixed seed.
- Statistics. Hit rates carry 95% Wilson intervals. Mean and median net R carry 95% intervals from a bootstrap that resamples whole calendar weeks, because detections cluster in time. The full R distribution is published: quartiles, 5th and 95th percentiles, losses beyond −1R, time exits and excursions.
- Splits and comparisons. One calendar date splits the period into the first 70% (in-sample) and the last 30% (out-of-sample); both are published and labelled. The single confirmatory test, run once on out-of-sample Binance data at 15m, 1h and 4h, asks whether mean net R differs from the matched control, judged by whether the 95% interval for the difference excludes zero. Venue, asset-class, timeframe, year and BTC/ETH-versus-other results are exploratory and carry Benjamini–Hochberg q-values.
- Reproducibility. Every figure is stamped with the detector's git commit, a SHA-256 hash of all detector, filter and cost parameters, data-snapshot checksums and the random seeds.
How success is defined
Primary outcome. A detection succeeds when, after entry, price reaches the target before the stop within 40 bars.
- Target: the detector's measured move, one pole height above the entry reference. As in the backtest engine, the entry reference is the signal bar's closing price.
- Stop: the flag low, with production's 0.2% buffer.
- Same-bar touches: a bar whose range covers both levels counts as a stop.
- Time exit: if neither level is reached within 40 bars, the trade closes at the 40th bar's closing price and counts as a non-success.
- Why 40 bars: it is the longest formation the detector accepts, a 15-bar pole plus a 25-bar flag.
R-multiple. R is the distance from the entry fill to the stop. A trade's result in R is its net profit or loss after fees, slippage and funding, divided by R. A clean stop-out lands slightly below −1R; gap-throughs can land well below it and are counted separately.
Reference points. Beside each hit rate the study reports a no-edge reference: a driftless random walk reaches a target T away before a stop S away with probability S ÷ (S + T), averaged over all detections. The matched random entries add real drift, the time limit and costs to that reference.
Secondary outcomes.
- Production defaults: target at the nearer of +10% and the measured move, stop at the tighter of −5% and the buffered flag low, reward:risk below 1 dropped. This shows how platform defaults would have traded the same detections.
- Default-signal subset: detections whose replayed PatternX Score, computed with the backtest engine's neutral context, is at least 65, the default minimum confidence. This approximates, but does not equal, what a live user would have been shown.
- Excursions and speed: maximum favourable and adverse excursion within 40 bars, in R, and bars to resolution.
Sensitivity. Horizons of 20 and 80 bars; doubled costs; entry at the signal bar's closing price.
Pattern and strategy criteria
The production rules for BULLISH_FLAG, used without modification. The bull flag page explains the shape, and how PatternX detects patterns covers the shared engine.
- Pole: the strongest close-to-close move over 5 to 15 bars, at least 3%, ending where the flag starts.
- Flag: 6 to 25 bars. It may lean in the pole's direction by at most 0.15% per bar, and it may retrace at most 50% of the pole.
- Breakout: a close above the flag's high on the latest bar.
- Levels: stop at the flag low; target at entry plus the pole height. In live use the stop becomes the tighter of the user's stop-loss and this level (with a 0.2% buffer), the target the nearer of the user's take-profit and this level, and setups with reward:risk below 1 are dropped.
- Universal filters: the breakout candle's close in the trade direction; breakout-bar volume at least 1.2× the 20-bar average; ATR% ≥ 0.05; liquidity score ≥ 30; spread ≤ 0.25%; order-book imbalance against the trade no worse than −0.5; on crypto venues, 24-hour volume ≥ $3M (brokers are exempt).
- What the detector does not check: there is no flag-specific volume rule beyond the universal 1.2× check, and no prior-trend test beyond the pole itself (only the rectangle detectors test prior trend). The continuation label is descriptive and drives no logic.
- Per scan: at most one match per detector; the geometry score is capped at 85.
In this replay, the pole, flag, breakout and level rules run unchanged, with the direction, volume, ATR% and reward:risk filters. Liquidity score, spread and order-book imbalance cannot be rebuilt from candles and are neutral; the 24-hour volume floor is approximated as described under exclusions. Detection is identical in PatternX Classic and PatternX AI; the AI context layer, which can only veto or re-weight a setup after detection, is not applied.
Exclusions
- Thin crypto markets: detections where the trailing 24 hours of candle volume, valued at each bar's closing price, is below $3M. This rebuilds production's 24-hour volume floor from candle data, so it is an approximation of the live check.
- Universe: contracts outside the venue's top 20 by trailing 30-day volume for that month; stablecoin and other pegged-asset pairs; a contract's first 7 days after listing.
- Stocks: bars affected by splits or other corporate actions the data does not adjust for, and outcome windows that contain a trading halt. Leveraged, inverse and bitcoin or ether ETFs are not in the stock set, because they repeat moves already counted elsewhere.
- Overlap: while a bull flag trade on a series is open, later bull flag detections on that series are skipped (one position per series, as in the backtest engine). Skipped detections are counted and reported.
- Data faults: a missing bar inside the 200-bar window or the 40-bar outcome window; bars with zero volume, missing prices or a high below the low; venue outages and maintenance windows.
- Untradeable at entry: detections whose next bar opens at or beyond the stop or the target. They are counted, not simulated.
- Censored: detections fewer than 40 bars before the end of the data.
- Warm-up: the first 200 bars of each series.
Limitations
- Replay is not live trading. Live signals can fire on a forming bar, appear at the plan's scan interval (10 to 120 seconds), wait for manual approval and expire after 15 minutes. The replay acts once per completed bar with an immediate entry, so live outcomes can differ in either direction.
- Neutral context. Spread, order book, liquidity score, funding, the higher-timeframe check and the live historical-win-rate factor are absent from replays. Live users also see only setups that clear their minimum confidence; this study measures the detector, not that filtered stream.
- Survivorship. Venues may not serve candles for delisted contracts. Gaps in the point-in-time universe are counted, but any that cannot be filled tilt the sample toward survivors. The curated stock list is a current list, so companies that left the market earlier in the period are missing from it, which carries the same bias.
- Data quality. Exchange candles can include bad prints and liquidation wicks, and venues build candles differently.
- Simplified execution. Flat fees, slippage and funding approximate reality. Real funding can be large in strong trends, and stops in fast markets can fill far worse than 0.03% away. Trailing stops, break-even moves, position sizing and the risk engine are not modelled.
- Regime dependence. Crypto history contains only a handful of long bull and bear phases, and the out-of-sample window covers one stretch of time. Results from one phase may not carry over to another.
- Dependence between detections. Coins move together and detections cluster in time, so the effective sample is smaller than the detection count; the week-block bootstrap corrects for this only in part.
- Scope. Findings will describe this detector at the recorded version. How outcomes vary with bar size is the subject of the timeframe study, and a frequency measured in the past is not a probability for any future trade.