Skip to content

Learn

Stock Strategy Development

A stock breakout strategy with volume confirmation and expiry

A volume-confirmed stock breakout is an event-entry strategy, not a rule to buy every day that price remains elevated. Freeze the prior-high and volume windows, define failure and maximum-holding exits, then trace next-open orders and restrictions into cash. Including the trigger day’s high in the breakout threshold can remove the event entirely.

This guide implements full 55- and 20-observation windows on one fictional ordinary A-share cash stock. All bars, permission flags and account values are synthetic. CoTrading strategy templates remain planned or unverified. The permission inputs do not reproduce an exchange order queue or every board and special-status rule.

Define the event from prior completed observations

At a completed close, require price strictly above the maximum high of the previous 55 bars, excluding the current bar. Require current volume strictly above 1.5 times the previous 20-bar average, also excluding the current bar. The first eligible event needs all 55 prior observations; a partial window is not accepted.

Turn the condition into an event when it becomes true after being false. A persistent true condition does not authorize repeated entries. The fixture does not add shares while already holding a position. Keep the event, desired state and executed quantity distinct so a repeated high-price day cannot silently multiply exposure.

The rule uses supplied finite positive OHLC prices and finite nonnegative volume. Invalid required fields raise rather than fabricate a tradable observation. Real adapters additionally need corporate-action consistency, historical eligibility and calendar alignment. A complete input shape does not guarantee those source properties.

Freeze two exit mechanisms and priority

Failure means the completed close is strictly below the low of the previous 20 bars, excluding the current bar. That decision requests sale at the next permitted supplied open. The maximum holding is twenty open-to-open session intervals from actual entry, not from signal formation or the latest repeated trigger.

At each open, a pending failure exit has priority over the maximum-holding label if both apply. An eligible exit is processed before an entry request. A sell permission block preserves shares and cash and keeps the exit obligation active; a target deadline is not proof that a real sale can always occur on that date.

The SSE 2026 trading rules show why trading and settlement constraints require instrument-specific checking. This example uses a minimal no-same-session-sale check and explicit permission flags. It does not infer all restrictions from a stock-code prefix or claim realistic price-limit queue execution.

Rebuild the first breakout

The first 55 bars have high eleven, low nine, close ten and volume one hundred. At index 55, the completed close is twelve, current high 12.5, low ten and volume two hundred. The prior 55-bar high is eleven and prior 20-bar average volume is one hundred.

Twelve is above eleven and two hundred is above 150, so an event occurs. There is no order at that same completed-close row. If current high 12.5 were included in the price threshold, twelve would not exceed it. The fixture’s exact intermediate assertions expose that wrong-window implementation.

The next supplied open, index 56, is 12.2. The account buys one hundred shares and pays a fictional fee of one. Starting cash 10,000 becomes 8,779. The one-hundred-share quantity is a fixed teaching choice, not a claim that quantity rules are identical across every A-share board.

Reconcile the ordinary maximum-holding exit

Subsequent closes stay twelve and do not fail the prior-low rule. The original entry remains index 56; it is not reset by later evaluations. At open 76, twenty intervals have elapsed and the supplied price is twelve. Sell one hundred shares and pay one more fee.

Sale net proceeds are 1,199, so final cash and equity are 9,978 with zero shares. Gross price loss is twenty, fees total two and net loss is twenty-two. This negative synthetic result is retained rather than redesigned into a favorable breakout performance claim.

The first entry day’s closing mark differs from the entry open: shares marked at twelve give equity 9,979 after the buy. That mark is not an exit and does not pay another fee. Preserve cash, quantity and marked equity separately so a chart movement cannot be confused with a completed transaction.

Reproduce a failure exit and opening gap

In a separate fixture, index 57 closes at eight with a low of 7.5. Its prior 20-bar low remains nine, because the current low is excluded. Eight is below nine and requests exit. No sale is backdated to that close; index 58 opens at 7.8 and supplies the actual modeled fill.

Selling one hundred at 7.8 less one fee gives final cash 9,558. The price loss is 440 and fees two. Including the current low would incorrectly compare eight with 7.5 and miss the failure. Using close eight as the exit instead of next open 7.8 would also overstate cash.

These failures test different layers: the prior-low window controls when exit is requested, while the later opening price controls proceeds. A correct final signal does not excuse an optimistic fill. The standalone script asserts the trigger row, the absence of a same-row order, the exact later sale and its cash result.

Preserve blocked entry and delayed exit paths

Set index 56 buy permission false in another run. The one-time entry attempt is rejected, cash remains 10,000, fees zero and shares zero. The example does not substitute a past close or keep retrying an expired event indefinitely. Later flat closes do not produce a fresh breakout event.

For a separate exit counterexample, block sale at index 76. No proceeds or fee are created, cash stays 8,779 and one hundred shares remain. At the next supplied permitted open, 77 at 12.2, the outstanding maximum-holding exit executes. Final cash becomes 9,998 with two total fees.

The actual holding therefore exceeds the target deadline in that blocked path. Report the delay rather than claim the position was sold exactly on time. A flag labeled opening limit block is a synthetic scenario input here, not proof that a complete historical price-band or queue model has been implemented.

Run the full-window acceptance pack

Download the complete example, save it as R586.py and run python R586.py with Python 3.12 or later. The standard-library source is docs/growth/research/round-5/examples/R586.py. It uses synthetic data only.

Assertions cover the complete warmup, prior thresholds, event-only timing, entry quantity and cash, maximum exit, failure exit, blocked entry and delayed sale. Exact orders, fee totals, quantities and cash are checked, not merely a signal count or a terminal constant.

Several truncated prefixes must reproduce the original historical ledger. A drastic change to a later close and high must leave the earlier entry path unchanged. The fixed deadline does not depend on the input’s last row, so truncation cannot create a fictional end-of-data liquidation.

Extend with market evidence before claiming realism

Archive formulas, window endpoints, event policy, entry expiry, exit priority, actual holding clock, permission source, costs and input versions. Review one normal and one blocked order before scaling to historical data. Real special-status, listing-age, price-band and liquidity effects need their own data and tests.

If a source or execution model changes, compare the first changed threshold, event and fill before interpreting a new return. Completion means the stated breakout mechanism and all shown account paths are reproducible. It does not prove breakouts succeed, guarantee maximum holding can always be enforced or certify true exchange matching from a daily price file.

During review, distinguish a requested maximum-holding exit from an executed one by checking quantity and cash, not its label alone. The blocked-at-76 path retains both until 77, while the ordinary path is already flat. Those two ledger rows are an acceptance boundary for any later execution-model change; a report must not force them to look identical merely because both originated from the same deadline rule.

FAQ

Does the trigger day’s high belong in the prior-high window?

No. The declared 55-bar threshold excludes the current bar.

Does a twenty-session limit guarantee actual exit at that instant?

No. An execution block preserves the position and must be reported as delayed exposure.