Opening Alignment: Moving-Average Picture, Position, and Color

Video: RELAX! WAIT FOR THESE 3 TO ALIGN AT THE OPEN
Creator: Oliver Velez Trading
Original Video: Watch the original video
Difficulty: Advanced

The Big Idea

Oliver Velez asks three questions before an opening trade: what is the moving-average picture, where does the stock open within that picture, and does the developing price action move in the same direction?

He calls these picture, position, and color. Alignment reduces the conflict between context and trigger. It does not make a trade certain, and a favorable chart description still needs an entry, stop, quantity, and exit policy.

The source also explains how a strong first move can lead to a second leg after either a bounce or a sideways pause. This guide separates that continuation model from the initial opening decision.

Picture: Classify the Moving-Average State

The chart uses two-minute candles and 20- and 200-period moving averages. The source distinguishes a bullish picture, a bearish picture, and a narrow, relatively flat state.

PictureTypical relationshipInterpretation
BullishThe 20 is above the 200 and risingRecent movement supports an upward bias
BearishThe 20 is below the 200 and decliningRecent movement supports a downward bias
Narrow or neutralThe averages are close and relatively flatDirection has not clearly expanded

These are price-derived states. They do not reveal a fixed balance of institutional buying and selling. A narrow state can later expand either way, while an established picture can lose momentum.

The source also distinguishes early and mature versions of each picture. A bearish arrangement beginning to separate is different from one already widely separated after several downward legs. Treat width and maturity as additional observations rather than assuming the average order alone defines the opportunity.

Position: Does the Opening Fit the Picture?

A bearish picture with an opening beneath the relevant averages supports a short thesis. An opening above that bearish arrangement creates conflicting information. The bullish version is the mirror image.

For a mechanical experiment, opening position needs exact boundaries. “Under the picture” might mean below both averages, while an opening between them could be treated differently. Decide the rule before reviewing winning examples.

Use moving-average values that were known before the open when classifying the premarket picture. A final average incorporating the completed opening candle contains information that was not available at the bell.

Color: Wait for Directional Evidence

In the bearish example, Velez wants downward movement to agree with the bearish picture and opening position. In a bullish example, the corresponding confirmation is upward movement.

The source’s Tesla discussion is important: the first candle does not finish red, even though it showed weakness while forming. Velez describes a later break using the first candle’s low as a reference; more aggressive traders might use a body boundary.

A candle’s developing color and its completed color are different observations. A backtest cannot see the final candle and assume that its eventual high, low, or body was available earlier.

The three checks should therefore be recorded at their actual decision times: pre-opening picture, opening location, and subsequent trigger. “All systems go” remains a hypothesis, not protection against reversal.

Risk Comes From the Event and the Position

The source places protection beyond the event that motivated entry or within an acceptable loss budget. A logical stop and a cash-risk limit must work together: placing a stop farther away requires smaller quantity if the budget is unchanged.

In an original short example, entry at 99.40 with a stop at 100.10 creates 0.70 of price risk per share. A hypothetical $140 budget permits 200 shares before costs. If entry deteriorates to 99.10 with the same stop, risk grows to 1.00 and the budget permits only 140 shares.

A narrow price stop can look attractive while still being sensitive to spread, adverse fills, and opening volatility. If the smallest sensible quantity or the expected execution risk exceeds the budget, the setup does not fit that budget.

Two Paths Toward a Second Leg

After a strong downward first leg, Velez watches either an upward bounce or a sideways pause. He then looks for renewed selling that breaks the intervening green candle or pause structure.

Pause typeWhat changes?Candidate continuation event
Upward bouncePrice retraces part of the declineSelling breaks the countertrend candle or area
Sideways driftPrice rests near the lowsSelling breaks the pause’s reference low

The source prefers a bounce that does not exceed approximately half of the first decline, while emphasizing that 50% is a guideline rather than an exact geometric rule.

For an original decline from 100 to 96, the halfway level is 98. A bounce to 97.50 retraces less than half. The reference low must be known when the bounce is assessed; using a later, deeper low to redefine the first leg would change the measurement after the fact.

A green candle being broken can supply a local risk reference for a second entry. It does not prove that a second leg will occur or match the first leg’s distance. More mature, widely separated moves may behave differently, but the source provides no complete statistical sample establishing their follow-through probabilities.

Missing the Open Does Not Create an Entry

Velez reports technical difficulty and missing several early minutes. He distinguishes what he might have done from what he actually traded afterward.

That distinction belongs in a journal. A reconstructed ideal entry is not an actual fill. A later starter position taken because a bounce may never arrive is also a separate entry policy from waiting for the described pause and color break.

After missing an entry, evaluate the available setup at the current price. Do not borrow the earlier trade’s stop distance or reward estimate. If a starter, add, and second-leg entry coexist, calculate the risk of the entire position.

Pine Script: Opening Alignment Test

Expand the complete Pine Script research strategy

//@version=6
strategy("Opening alignment + first-range break - research proxy", 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)

usePicture = input.bool(true, "Require 20/200 picture")
usePosition = input.bool(true, "Require opening outside both averages")
requireFirstColor = input.bool(false, "Also require first candle color")
slopeBars = input.int(5, "20 SMA slope lookback", minval=1)
waitBars = input.int(5, "Maximum later bars for opening break", minval=1)
reward = input.float(2, "Target R from actual fill", minval=0.1)
cashRisk = input.float(100, "Estimated cash risk before costs", minval=1)
maxShares = input.int(1000, "Maximum shares", minval=1)
allowShorts = input.bool(true, "Allow shorts; verify borrow")
exitMinutes = input.int(30, "Time exit: minutes after 9:30", minval=4, maxval=390)

if barstate.isfirst and (not chart.is_standard or not timeframe.isminutes or timeframe.multiplier != 2)
    runtime.error("Use standard two-minute US stock candles.")
if session.ispremarket or session.ispostmarket
    runtime.error("Disable extended hours for this regular-session test.")

sma20 = ta.sma(close, 20)
sma200 = ta.sma(close, 200)
firstBar = hour(time, "America/New_York") == 9 and minute(time, "America/New_York") == 30
minutesClose = hour(time_close, "America/New_York") * 60 + minute(time_close, "America/New_York")
varip float openingHigh = na
varip float openingLow = na
varip int openingBar = na
varip bool longOK = false
varip bool shortOK = false
varip bool used = false
varip float tradeStop = na
varip float tradeTarget = na
varip float seenPosition = 0.0
fillPass = strategy.position_size != seenPosition
seenPosition := strategy.position_size

if fillPass and strategy.position_size != 0
    distance = strategy.position_size > 0 ? strategy.position_avg_price - tradeStop : tradeStop - strategy.position_avg_price
    if distance > 0
        tradeTarget := strategy.position_avg_price + (strategy.position_size > 0 ? 1 : -1) * reward * distance
    else
        tradeTarget := na
        strategy.close_all(comment="Fill beyond stop", immediately=true)

if not fillPass and barstate.isconfirmed
    if firstBar
        ready = not na(sma200[1]) and not na(sma20[slopeBars + 1])
        bullPicture = sma20[1] > sma200[1] and sma20[1] > sma20[slopeBars + 1]
        bearPicture = sma20[1] < sma200[1] and sma20[1] < sma20[slopeBars + 1]
        longOK := ready and (not usePicture or bullPicture) and
             (not usePosition or open > math.max(sma20[1], sma200[1])) and
             (not requireFirstColor or close > open)
        shortOK := ready and allowShorts and (not usePicture or bearPicture) and
             (not usePosition or open < math.min(sma20[1], sma200[1])) and
             (not requireFirstColor or close < open)
        openingHigh := high
        openingLow := low
        openingBar := bar_index
        used := false

    if not used and strategy.position_size == 0 and not na(openingBar) and
         bar_index > openingBar and bar_index - openingBar <= waitBars and minutesClose < 570 + exitMinutes
        longSignal = longOK and close > openingHigh and close > open
        shortSignal = shortOK and close < openingLow and close < open
        if longSignal or shortSignal
            candidateStop = longSignal ? math.min(openingLow, low) - syminfo.mintick : math.max(openingHigh, high) + syminfo.mintick
            unitRisk = math.abs(close - candidateStop) * syminfo.pointvalue
            shares = unitRisk > 0 ? math.floor(math.min(maxShares, cashRisk / unitRisk)) : 0
            if shares >= 1
                tradeStop := candidateStop
                tradeTarget := na
                used := true
                if longSignal
                    strategy.entry("L", strategy.long, qty=shares)
                    strategy.exit("L-bracket", "L", stop=tradeStop)
                else
                    strategy.entry("S", strategy.short, qty=shares)
                    strategy.exit("S-bracket", "S", stop=tradeStop)

    if strategy.position_size != 0 and minutesClose >= 570 + exitMinutes
        strategy.cancel_all()
        strategy.close_all(comment="Opening time exit", immediately=true)

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(sma20, "20 SMA", color=color.blue)
plot(sma200, "200 SMA", color=color.orange)
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 strategy below tests a completed-candle approximation of the initial opening model. It does not simulate the second-leg entry.

Our definitions: the moving averages are SMAs. A bullish picture requires the prior 20 SMA above the prior 200 SMA and above its value five bars earlier; a bearish picture reverses those conditions. Opening position must be above both prior averages for a long or below both for a short.

The first two-minute candle defines a fixed range. A later bullish close above its high supplies the long trigger; a later bearish close below its low supplies the short trigger. The first candle need not itself close in that direction, matching the source’s observation that its color can change.

The stop is beyond both the opening candle and trigger candle’s relevant extreme. Defaults are five later bars to find an entry, estimated $100 cash risk capped at 1,000 shares, a 2R target from the actual fill, and a time exit 30 minutes after the open. These numbers and exit rules are research choices, not the source’s exact play.

Execution QA

Use standard two-minute US equity candles with extended hours disabled and enough history for the 200 SMA. Picture and position are evaluated using pre-opening average values. The fixed opening range becomes available only after the first candle closes.

Signals are evaluated at later completed closes. Market entries normally fill at the next bar’s open, later than the source’s intrabar entries. The protective stop is submitted alongside entry.

A fill-only recalculation sets the target from actual entry and the frozen stop without using the fill bar’s completed high or low to select another setup. A fill beyond the stop prompts an immediate simulated exit. There is at most one submitted entry per session.

Quantity is estimated from the signal close, so actual cash risk can change after a gap. Commission defaults to 0.01% per fill and slippage to two ticks, adjustable in Strategy Properties. Borrow availability, borrow fees, variable spreads, partial fills, and short-sale restrictions are not modeled. The 100% margin assumption can prevent a qualifying order from filling.

The time exit uses an immediate simulated closing fill, an optimistic assumption requiring cost stress. Same-bar bracket outcomes depend on emulator assumptions; inspect ambiguous trades with Bar Magnifier where available. TradingView’s strategy documentation (paid link) explains order timing and simulated-fill behavior.

The code has been reviewed for its stated logic but has not been compiled or backtested in TradingView. It tests opening classification and a later range break, not early developing candle color, neutral-state expansion, partial profits, starter positions, or second-leg adds. No performance result is claimed.

Backtest Lab

ComparisonChange one conditionEvaluate
Moving-average pictureToggle its requirementNet expectancy and participation
Opening positionToggle the outside-both-averages ruleWhether conflicting openings behave differently
First candle colorRequire or ignore its completed directionTrades excluded and later-break outcomes
Execution sensitivityIncrease costs and slippageWhether the opening advantage survives friction

Keep instruments and dates fixed, include losses, and validate unchanged rules on an unseen period. Separately collect first-leg and pause examples before evaluating second-leg entries. Define bounce depth, sideways-pause duration, and the exact candle-break trigger instead of selecting only the cleanest continuations afterward.

Final Takeaway

The source’s three checks give context, location, and trigger distinct roles. A later pause can create another opportunity, but it requires a new entry and risk calculation. Define each observation at the time it becomes available, and judge alignment by complete trade outcomes rather than an attractive chart alone.


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. Short selling carries borrow and potentially unlimited-loss risks. Stops do not guarantee an execution price. 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 Oliver Velez Trading.

As an Amazon Associate I earn from qualifying purchases.