Mechanical Market Structure: Failure, Shift, and Retest

Video: I Made Market Structure Completely Mechanical (Full Strategy)
Creator: The Secret Mindset
Original Video: Watch the original video
Difficulty: Advanced

The Big Idea

A higher high describes what price printed. What price does afterward determines whether that breakout becomes a useful continuation opportunity or a failed move.

The Secret Mindset emphasizes that second part: examine an important external level, observe acceptance or failure, and use internal structure to time the trade. For a failed-break reversal, the source waits for more than a reclaim. It requires an internal shift and a retest before entry.

The title calls the approach completely mechanical, but terms such as “clear,” “strong,” and “holds several candles” still need numerical definitions. This guide explains the sequence and supplies one explicit research model without presenting its added rules as the creator’s exact system.

External Structure Sets Location

External structure includes major highs and lows, range boundaries, and previous-day levels. Internal structure consists of the smaller swings within that larger movement.

A bullish five-minute break can occur directly beneath an hourly range high. Both observations can be accurate. The small break supplies timing information, while the larger level limits the trade’s available space.

Assign the two layers different jobs. Identify the external area first, then specify which internal level would need to break. Do not promote an insignificant intrarange swing into the entire directional thesis simply because it generated a signal.

Market stateUseful questionSource’s preferred location
Expanding trendDoes the protected swing hold as price advances?A defined continuation pullback
Rotating rangeDoes an edge hold, fail, or become accepted?The range boundaries
Unclear transitionHas a reliable map formed yet?Wait for a clearer decision

This is a classification framework, not a guarantee that ranges or trends can always be identified cleanly. Overlapping candles and repeated failed breaks may justify leaving a setup unclassified.

A Break and Acceptance Are Different Events

A continuation idea begins when price breaks a level, stays beyond it, and subsequently defends it on a retest. The source treats that response as acceptance. Price can pause without immediately continuing, but a rapid return inside the old range weakens the thesis.

For a test, define how many closes count as holding, how far outside is enough, how much retest penetration is allowed, and how long the process may take. “It eventually rallied” cannot be the acceptance rule because that information arrives after the trade.

Likewise, a return inside a broken level is a warning rather than an automatic reversal entry. The source’s failed-break model waits for the smaller structure supporting the original move to fail too.

The Failed-Break Reversal Has a Sequence

StageBullish reversal from a lowBearish reversal from a high
External attackPrice moves beneath a marked lowPrice moves above a marked high
Failure to remain outsideA close back above the lowA close back below the high
Internal shiftA close above the selected lower highA close below the selected higher low
EntryA later retest rejects upwardA later retest rejects downward
ProtectionBeneath the sweep extremeAbove the failed-break extreme

The internal level must be identified before its break. If a trader redraws it afterward to fit a winning move, the sequence becomes a story rather than a rule.

The transcript contrasts a reclaim that subsequently breaks internal resistance with a reclaim that does not. The latter can recover briefly and then make another low. Requiring the shift can avoid some premature entries, while also entering later or missing moves that never retest.

Original Example: Why Location Changes the Trade

Suppose a premarked range spans 100–110. Price sweeps to 99, closes back above 100, then breaks an internal lower high at 102. A later retest produces a hypothetical entry at 102.20 with a stop at 98.90.

Price risk is 3.30 units. A target at the opposite edge, 110, offers 7.80 units, approximately 2.36R before costs. If entry is delayed to 106 with the same stop, risk is 7.10 units and reward to 110 is only four: about 0.56R.

The directional idea can be similar while the trade economics differ substantially. This explains why the source emphasizes location and a logical failure point, rather than treating every internal bullish break equally.

A near-edge entry is not necessarily better in practice. Its stop may be more vulnerable to ordinary fluctuations, and the expected move may fail. Compare outcome distributions rather than judging the setup from one clean chart.

What “Control” and “Liquidity” Can Tell You

The source uses control as shorthand for price defending or losing a reference. That is a useful description of behavior. Candles alone do not identify the traders responsible or establish their intentions.

Obvious highs and lows can influence decisions, including breakout entries and stop placement. But the chart does not reveal every resting order, confirm how many stops were executed, or prove that a break was engineered to trap someone.

The source also acknowledges a further participation layer involving volume or footprint data that this video does not cover. Do not add an invented volume-confirmation rule and attribute it to the presented strategy.

Pine Script: Failure, Shift, and Retest

Expand the complete Pine Script research strategy

//@version=6
strategy("External sweep, internal shift, retest - research model", overlay=true,
     initial_capital=25000, pyramiding=0, margin_long=100, margin_short=100,
     commission_type=strategy.commission.percent, commission_value=0.01,
     slippage=2, calc_on_order_fills=true, calc_on_every_tick=false,
     process_orders_on_close=false)

pivotBars = input.int(2, "Internal pivot left/right bars", minval=1)
reclaimBars = input.int(3, "Maximum bars to reclaim", minval=0)
shiftBars = input.int(10, "Maximum bars after reclaim to shift", minval=1)
retestBars = input.int(10, "Maximum bars after shift to retest", minval=1)
toleranceATR = input.float(0.15, "Retest tolerance / ATR at sweep", minval=0)
targetMode = input.string("Opposite daily edge", "Target", options=["Opposite daily edge", "Fixed R"])
reward = input.float(2, "Fixed target R", minval=0.1)
cashRisk = input.float(100, "Estimated cash risk before costs", minval=1)
qtyStep = input.float(1, "Quantity increment", minval=0.000001)
maxQty = input.float(100, "Maximum quantity", minval=0.000001)

if barstate.isfirst and (not chart.is_standard or not timeframe.isintraday)
    runtime.error("Use standard intraday candles.")

[externalHigh, externalLow] = request.security(syminfo.tickerid, "D",
     [high[1], low[1]], gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_on)
ph = ta.pivothigh(high, pivotBars, pivotBars)
pl = ta.pivotlow(low, pivotBars, pivotBars)
atr = ta.atr(14)
newDay = timeframe.change("D")

varip float lastHigh = na
varip float previousHigh = na
varip float lastLow = na
varip float previousLow = na
varip int stage = 0
varip int side = 0
varip int eventBar = na
varip float edge = na
varip float internalLevel = na
varip float extreme = na
varip float targetEdge = na
varip float tolerance = na
varip float tradeStop = na
varip float tradeTarget = na
varip float seenPosition = 0.0
varip int lastFillBar = na

fillPass = strategy.position_size != seenPosition
seenPosition := strategy.position_size
if fillPass
    lastFillBar := bar_index
    if strategy.position_size != 0
        distance = strategy.position_size > 0 ? strategy.position_avg_price - tradeStop : tradeStop - strategy.position_avg_price
        tradeTarget := targetMode == "Fixed R" ? strategy.position_avg_price + (strategy.position_size > 0 ? 1 : -1) * reward * distance : targetEdge
        validTarget = strategy.position_size > 0 ? tradeTarget > strategy.position_avg_price : tradeTarget < strategy.position_avg_price
        if distance <= 0 or not validTarget
            tradeTarget := na
            strategy.close_all(comment="Invalid gap fill", immediately=true)

if not fillPass and barstate.isconfirmed
    // Pivots become usable NOW, not on their earlier turning-point bars.
    if not na(ph)
        previousHigh := lastHigh
        lastHigh := ph
    if not na(pl)
        previousLow := lastLow
        lastLow := pl
    if newDay
        stage := 0

    if strategy.position_size == 0 and (na(lastFillBar) or bar_index > lastFillBar)
        sweepLow = low < externalLow
        sweepHigh = high > externalHigh
        if stage == 0 and not na(atr) and not (sweepLow and sweepHigh)
            if sweepLow and lastHigh < previousHigh and lastHigh > close
                side := 1
                edge := externalLow
                internalLevel := lastHigh
                extreme := low
                targetEdge := externalHigh
                tolerance := atr * toleranceATR
                eventBar := bar_index
                stage := 1
            else if sweepHigh and lastLow > previousLow and lastLow < close
                side := -1
                edge := externalHigh
                internalLevel := lastLow
                extreme := high
                targetEdge := externalLow
                tolerance := atr * toleranceATR
                eventBar := bar_index
                stage := 1

        if stage == 1
            extreme := side == 1 ? math.min(extreme, low) : math.max(extreme, high)
            reclaimed = side == 1 ? close > edge : close < edge
            if bar_index - eventBar > reclaimBars
                stage := 0
            else if reclaimed
                stage := 2
                eventBar := bar_index
        else if stage == 2
            invalid = side == 1 ? low <= extreme : high >= extreme
            shifted = side == 1 ? close > internalLevel : close < internalLevel
            if invalid or bar_index - eventBar > shiftBars
                stage := 0
            else if shifted and bar_index > eventBar
                stage := 3
                eventBar := bar_index
        else if stage == 3
            invalid = side == 1 ? low <= extreme : high >= extreme
            touched = low <= internalLevel + tolerance and high >= internalLevel - tolerance
            rejected = side == 1 ? close > internalLevel and close > open : close < internalLevel and close < open
            if invalid or bar_index - eventBar > retestBars
                stage := 0
            else if bar_index > eventBar and touched and rejected
                candidateStop = extreme - side * syminfo.mintick
                distance = side == 1 ? close - candidateStop : candidateStop - close
                targetOK = targetMode == "Fixed R" or (side == 1 ? targetEdge > close : targetEdge < close)
                unitRisk = distance * syminfo.pointvalue
                quantity = unitRisk > 0 ? math.floor(math.min(maxQty, cashRisk / unitRisk) / qtyStep) * qtyStep : 0
                if distance > 0 and quantity >= qtyStep and targetOK
                    tradeStop := candidateStop
                    tradeTarget := na
                    if side == 1
                        strategy.entry("L", strategy.long, qty=quantity)
                        strategy.exit("L-bracket", "L", stop=tradeStop)
                    else
                        strategy.entry("S", strategy.short, qty=quantity)
                        strategy.exit("S-bracket", "S", stop=tradeStop)
                stage := 0

if strategy.position_size > 0 and not na(tradeTarget)
    strategy.exit("L-bracket", "L", stop=tradeStop, limit=tradeTarget)
if strategy.position_size < 0 and not na(tradeTarget)
    strategy.exit("S-bracket", "S", stop=tradeStop, limit=tradeTarget)

plot(externalHigh, "Previous daily high", color=color.orange)
plot(externalLow, "Previous daily low", color=color.blue)
plot(stage != 0 ? internalLevel : na, "Frozen internal reference", color=color.purple, style=plot.style_linebr)
plot(strategy.position_size != 0 ? tradeStop : na, "Stop", color=color.red, style=plot.style_linebr)
plot(strategy.position_size != 0 ? tradeTarget : na, "Target", color=color.green, style=plot.style_linebr)

The following strategy tests the failed-break branch using previous completed daily highs and lows as external references. It does not automate the source’s discretionary range selection or acceptance-continuation branch.

Our experimental definitions: internal pivots require two bars on each side. Two declining confirmed pivot highs qualify the short-term structure for a bullish reversal; two rising confirmed pivot lows qualify it for a bearish reversal. The latest relevant pivot is frozen when the external sweep occurs.

The reclaim must arrive within three subsequent bars, although it may occur on the sweep candle. The internal break must happen on a later bar, within ten bars of reclaim. A later retest must occur within another ten bars and close in the trade direction. Retest tolerance is 0.15 ATR, frozen at the sweep.

The stop sits one tick beyond the sweep extreme. The default target is the opposite previous-day edge, with a fill-based fixed-R alternative. These choices make the sequence executable; they are not claimed as the creator’s exact numerical rules.

Execution QA: When Was the Level Known?

Use standard intraday candles. A pivot with two right-hand bars is confirmed only after those bars arrive. The code updates its pivot reference at confirmation time and never treats the earlier turning point as an immediately available signal. TradingView’s repainting documentation (paid link) explains the misleading effect of placing later-confirmed information back on earlier bars.

Daily references use the previous completed daily bar with a matching historical offset. For futures, the daily bar can follow the exchange’s trading session rather than a midnight calendar day. It is not necessarily the previous regular-session high or low. Keep the feed and session definition consistent.

While waiting for a reclaim, the sweep extreme can deepen. After reclaim, it is frozen; a subsequent touch or penetration of that extreme cancels the setup. This conservative equality rule is stricter than waiting for a clear break beyond it. A candle sweeping both daily edges is rejected as ambiguous.

One active setup is retained until completed, invalidated, expired, or cleared by a new daily period. Later pivots do not overwrite its frozen internal level. The shift and retest require separate later candles; the code cannot assume a favorable sequence of several events inside one candle.

A confirmed retest submits a market order normally filled at the next bar’s open. The protective stop is submitted with it. A fill-only recalculation establishes the target using the actual entry and frozen stop, without selecting another setup from the fill bar’s completed high or low. A fill beyond the stop or beyond an invalid opposite-edge target prompts an immediate simulated exit.

Quantity is estimated from the signal close, so gap and slippage risk can differ from the budget. Set the increment and maximum quantity for the actual instrument. The cash-risk calculation assumes the account and instrument profit-and-loss values use the same currency; conversion is not modeled. The 100% margin default can reject otherwise qualifying orders.

Commission defaults to 0.01% per fill and slippage to two ticks, adjustable in Strategy Properties. The model does not include variable spreads, borrow fees, funding, or exchange-specific restrictions. Positions stay open until a bracket fills; there is no session flatten. Same-bar stop and target outcomes depend on emulator assumptions and deserve inspection with Bar Magnifier where available.

The code has been reviewed for its stated logic but has not been compiled or backtested in TradingView. It tests one defined failure sequence, not the entire system or a proven distinction between market control and gambling.

Backtest Lab

ExperimentChangeEvaluate
Internal swing scaleVary pivot confirmation lengthSignal delay, trade count, net expectancy
Reclaim speedCompare shorter and longer reclaim windowsWhether fast failures differ from slower returns
Retest toleranceVary the frozen ATR allowanceSensitivity to zone width and false confirmations
Exit policyOpposite edge versus fixed RActual reward/risk, drawdown, holding time

Keep instruments and dates fixed, change one assumption at a time, and validate unchanged rules on unseen data. To study whether the retest adds value, separately compare entry after the internal shift with entry after its retest, including opportunities missed by waiting. Selected winners cannot resolve that tradeoff.

Final Takeaway

A structural label is the beginning of an observation. The source’s useful progression is to test the external level, observe failure or acceptance, and demand the appropriate internal response. Defining those events in advance makes the method reviewable and helps distinguish a complete trade sequence from an attractive but unfinished setup.


Risk Disclosure: This material is for educational and research purposes only and is not financial or investment advice. Trading can result in substantial losses. Backtests are hypothetical, depend heavily on their assumptions, and cannot reproduce every aspect of live execution. Commissions, spreads, slippage, liquidity, gaps, order behavior, market regime changes, and discretionary decision-making can materially affect real-world results. Leveraged products and short selling carry additional risks. Historical results do not guarantee future performance.

This article is an independent educational companion to the video and is not affiliated with, sponsored by, endorsed by, or authorized by The Secret Mindset.

As an Amazon Associate I earn from qualifying purchases.