Myth Busting E01 - First 4-Hour Range False Breakout [PyneSys] — Strategy by PyneSys

By PyneSys

Performance Metrics

Description

Myth Busting E01 - First 4-Hour Range False Breakout [PyneSys]PURPOSE AND SCRIPT AUTHORSHIPThis script was independently written by PyneSys. Data Trader is credited for presenting the trading concept, not for authoring this code.This script makes a first-four-hour-range false-breakout concept attributed to Data Trader testable on standard 5-minute candles. It is our mechanical interpretation of the idea, rather than a claim to reproduce unknown original code or discretionary decisions. Explicit timing, state and rejection rules make assumptions inspectable. Sections read top to bottom: section 6 finds the false breakout's re-entry, section 7 holds the optional filters, and section 8 plans the levels and places every order. Optional filters allow separate rule comparisons. This is the complete research implementation. Optional variants are separate hypotheses and are disabled by default; combining them is another experiment.SETUP AND ORDERSAfter the reference range is completed, wait for a confirmed close strictly above its high or below its low. A later close strictly inside the range on the same setup date creates a reversal signal: short after an upside breakout, long after a downside breakout. An exact boundary touch is not re-entry. An opposite-side breakout replaces the pending setup.COPYRIGHT AND LICENSEScript copyright (c) 2026 PyneSys LLC. The Pine and matching compiled Pyne source are licensed under MPL-2.0. When distributing covered source, retain copyright/license notices and provide modified covered source under MPL-2.0. Commercial use is allowed; no trademark rights are granted. This code copyright is separate from trading-concept attribution. The full terms are supplied in the source package as LICENSE.txt and are available at mozilla.org/MPL/2.0/.The baseline stop uses the most extreme wick from the initial outside-close candle through the re-entry candle, including both. The stop buffer defaults to zero ticks. The target defaults to 2R, where R is the distance between the signal close and planned stop. Entries are submitted at the confirmed signal close with process_orders_on_close enabled; the emulator can fill at that close. This is an execution assumption, not a guarantee of an executable live fill. Slippage can change the realized reward/risk.Stops and targets remain fixed while a trade is open. One position is allowed at a time, but more than one setup per day is possible. Open trades can continue into another date. Pending setups reset with the range's calendar date. Every confirmed re-entry consumes its setup, including a re-entry rejected by filters or occurring while a position is open; skipped setups are not queued.CHART, TIME AND RANGE DEFINITIONSUse standard 5-minute OHLC candles; the source rejects other chart timeframes. The default range is New York 00:00-04:00, aggregated from chart bars. The alternatives are First native 4h candle, UTC 00:00-04:00, New York 09:00-13:00 and Fixed EST 09:00-13:00. Native four-hour boundaries follow the instrument's session alignment; changing chart display timezone does not realign them. Native dates are grouped in America/New_York. New York follows daylight saving time; Fixed EST is UTC-5 year-round. Each fixed window uses its own calendar date for range and setup resets.The first observed setup date is warm-up. The exact opening chart bar of a reference range must be observed. Missing bars are not reconstructed; incomplete history can change measured ranges and must be inspected. A zero-width range cannot qualify. Signals must open after the reference range is complete and close on the same setup date; a close at local midnight is ineligible.INPUTS AND EXPERIMENTSReward/risk defaults to 2 and stop buffer to 0. Maximum stop distance defaults to None. Optional maximums are ATR, Opening range % or Previous NY day %. ATR length is 14 chart bars and maximum ATR multiple is 2. Opening-range maximum is 50%; previous-day maximum is 25%. These thresholds are research assumptions, not optimized or established profitable settings.ATR is frozen before the breakout begins. Previous NY day range means the last observed completed New York calendar date measured from chart data, not a provider daily candle; the first partially observed day is discarded. The maximum-stop filters reject entries without moving their stops. Equality with a valid maximum qualifies; missing or zero reference values reject a filtered setup. Stop and target distances must each be at least one tick.Additional variants are independent research assumptions, not promises of improvement:- Minimum confirmed breakout: None (default), ATR or opening-range percentage. Thresholds are 0.25 times pre-breakout ATR and 5% of the opening range. The largest confirmed close beyond the boundary is measured; wicks do not count.- Opposite-boundary target cap: off by default. If it binds, the stop is derived from the capped target distance and planned reward/risk, changing stop logic.- Midpoint target: off by default. It retains the selected stop, overrides the target cap and rejects a target on the wrong side of the entry reference.- EMA50 direction filter: None (default), 5 minutes, 15 minutes or 1 hour. Longs require a close above the EMA; shorts below. Higher-timeframe values are aggregated from complete UTC-aligned 5-minute groups, with 50 completed observations for the selected EMA. Missing groups delay eligibility.- Signal timeframe: 5 minutes (default) or completed aggregated 15 minutes. The chart and exit execution remain 5-minute. Pre-breakout ATR uses the observation before the selected signal group.- Entry-time filter: None (default), Skip 09:30-10:30 or From 10:00, evaluated at signal close in New York. It does not force an end-of-session exit.- Weekday entries only: off by default, using New York calendar weekdays.- Stop placement: Breakout extreme (default) or Fixed price distance. The fixed distance defaults to 10 price units, not 10 pips, and ignores the tick buffer. A fixed price distance is not transferable between instruments.Completed range, stop/target levels and filter-rejection markers are shown by default. The Data Window exposes reference and candidate distances for checking why a setup qualified or was rejected.The defaults are the named New York midnight baseline: New York 00:00-04:00, reward/risk 2 and Maximum stop distance None, with every optional variant disabled. Match instrument, feed, history and costs before comparing any results.STRATEGY PROPERTIESPosition size defaults to 10% of equity, with pyramiding 0. Ten percent is the position allocation, not the equity risk at the stop. Initial capital is not fixed in the source. The TradingView publication check used the current platform default of USD 100,000. This comparison baseline is not a recommended account size or a risk budget. Set capital and sizing to your own account when evaluating exposure. Commission type is percentage, with value 0; slippage is 0 ticks. Calculation on every tick and after fills are both disabled. Orders are evaluated at bar close; process_orders_on_close is enabled for the baseline fill assumption. Base currency follows the symbol default. Margin is not overridden: Pine v6 defaults to 100% long/short. Bar Magnifier is not enabled by the source; limit-fill verification defaults to 0 ticks. Historical stop/target ordering uses the broker emulator's assumed price path. Bar Magnifier, another feed or changed Properties can alter outcomes; none guarantees real tick execution or a live fill.COSTS AND INTERPRETING RESULTSCommission and slippage default to zero for a gross research baseline across markets, not an assumption of free trading. Instrument, broker, venue and order type determine costs; one preset would not represent them all. Default results exclude costs and are not achievable net returns.Before assessing performance, use Settings > Properties to set your commission type/value and slippage in ticks. Commission applies at entry and exit; slippage affects market/stop fills and does not fully model limit execution. Spread, funding, borrow fees and other applicable costs need an explicit model, avoiding double-counting costs represented by commission/slippage. Separate research cost sensitivity calculations are not this script's Strategy Tester output.TEST SCOPEA publication check on standard CAPITALCOM:XAUUSD 5-minute candles used the full available Deep Backtesting window, May 1, 2017 through October 21, 2026, and produced 3,074 closed trades with the baseline inputs and zero commission/slippage. This is a gross historical simulation, not a net-return claim. Deep Backtesting trades appear in the report and do not all appear on the chart; the published chart-loaded report covers July 13 through October 21, 2026 and contains 89 closed trades. That shorter sample is a platform chart-history limit, not the complete evaluation; the separate full-history check supplies the larger sample. Record the symbol/feed, standard timeframe, session, date window, inputs, Properties, closed trade count and costs when comparing runs. Provider, history, session and intrabar differences can change results. Historical simulations do not establish future performance or demonstrate that the source idea is profitable.LIMITATIONS AND USAGEUndefined resistance/order-block discretion and an undefined 'too large' stop cannot be reproduced without additional rules. This implementation documents those gaps instead of claiming equivalence to the source author's results.Apply to standard 5-minute candles, choose the desired range definition and baseline, then change one optional rule at a time. Set market-specific costs and appropriate capital/sizing in Properties before interpreting performance. Inspect range boundaries, entry markers, brackets and Data Window values to confirm that a run represents the intended experiment.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView