Skip to main content

Session-Based Strategies & Breakouts

Daily breakout indicators, pre-market breakout detection, afternoon vs morning range expansion, hiding lower timeframes, and referencing lower timeframes safely.

From Thrive on YouTube

Watch the matching Thrive video

More on YouTube
Breakouts vs Pullbacks: Two Ways to Enter and How to Choose

Breakouts vs Pullbacks: Two Ways to Enter and How to Choose

Education only. Not financial advice.

Daily Breakout Indicator

A daily breakout occurs when price decisively moves above the previous day's high or below the previous day's low. These levels are universally watched. Every institutional trading desk, every market maker algorithm, and every retail trader with a daily chart can see them. When BTC breaks above yesterday's high on strong volume, it signals that buyers have overcome the prior session's resistance. The breakout indicator detects these events in real time and marks them on your chart.

pine-Daily breakout detector with volume confirmation
1//@version=5
2indicator("Daily Breakout Detector", overlay=true)
3
4volMult = input.float(1.5, "Volume Confirm Multiplier", step=0.1)
5
6// Previous day's high and low (non-repainting)
7[prevHigh, prevLow] = request.security(syminfo.tickerid, "D",
8 [high[1], low[1]], lookahead=barmerge.lookahead_on)
9
10// Volume confirmation
11avgVol = ta.sma(volume, 20)
12highVol = volume > avgVol * volMult
13
14// Breakout detection
15var bool brokeHigh = false
16var bool brokeLow = false
17
18// Reset flags on new day
19if ta.change(time("D"))
20 brokeHigh := false
21 brokeLow := false
22
23// Detect first breakout of the day
24bullBreak = not brokeHigh and close > prevHigh and highVol
25bearBreak = not brokeLow and close < prevLow and highVol
26
27if bullBreak
28 brokeHigh := true
29if bearBreak
30 brokeLow := true
31
32// Visualization
33plot(prevHigh, "Prev High", color.new(color.red, 30), 2, plot.style_stepline)
34plot(prevLow, "Prev Low", color.new(color.green, 30), 2, plot.style_stepline)
35
36plotshape(bullBreak, "Bull Break", shape.triangleup,
37 location.belowbar, color.green, size=size.small, text="Break")
38plotshape(bearBreak, "Bear Break", shape.triangledown,
39 location.abovebar, color.red, size=size.small, text="Break")
40
41alertcondition(bullBreak, "Bullish Daily Breakout",
42 "Price broke above previous day high with volume")
1

Why volume matters

A breakout without volume is a fakeout waiting to happen. The volume multiplier (default 1.5x average) ensures the move has genuine participation. On BTCUSDT, you want to see at least 1.5x normal volume on the breakout candle for confirmation.
2

One signal per day

The var bool brokeHigh flag ensures you only get one breakout signal per direction per day. Without this, every candle above the previous high would trigger, flooding your chart with redundant markers.
3

New day reset

ta.change(time("D")) detects when a new daily bar begins on any timeframe. This resets the breakout flags, allowing fresh detection for each trading day.

Pre-Market Breakout Detection

In crypto, there is no official "pre-market" since markets trade 24/7. However, the period between the US close (4 PM EST) and the Asian open (8 PM EST) is typically the lowest volume window of the day. Moves that occur during this dead zone and sustain into the Asian session often set the tone for the next 24 hours. This indicator captures range expansion during low-liquidity hours.

pine-Low-volume window breakout indicator
1//@version=5
2indicator("Off-Hours Breakout", overlay=true)
3
4quietStart = input.session("1600-2000", "Quiet Window (NY time)")
5asianOpen = input.session("2000-0400", "Asian Session (NY time)")
6tz = "America/New_York"
7
8// Track quiet window range
9inQuiet = not na(time("", quietStart, tz))
10inAsian = not na(time("", asianOpen, tz))
11
12var float quietHigh = na
13var float quietLow = na
14var bool tracked = false
15
16if inQuiet
17 if not tracked
18 quietHigh := high
19 quietLow := low
20 tracked := true
21 else
22 quietHigh := math.max(quietHigh, high)
23 quietLow := math.min(quietLow, low)
24else if not inQuiet and not inAsian
25 tracked := false
26
27// Breakout during Asian session
28asianBullBreak = inAsian and ta.crossover(close, quietHigh) and not na(quietHigh)
29asianBearBreak = inAsian and ta.crossunder(close, quietLow) and not na(quietLow)
30
31plot(inAsian or inQuiet ? quietHigh : na, "Quiet High",
32 color.new(color.orange, 30), 1, plot.style_stepline)
33plot(inAsian or inQuiet ? quietLow : na, "Quiet Low",
34 color.new(color.teal, 30), 1, plot.style_stepline)
35
36plotshape(asianBullBreak, "Asian Bull Break", shape.arrowup,
37 location.belowbar, color.green, size=size.small)
38plotshape(asianBearBreak, "Asian Bear Break", shape.arrowdown,
39 location.abovebar, color.red, size=size.small)

Morning vs Afternoon Range Expansion

Statistically, the first four hours of the US session (9:30 AM – 1:30 PM EST) produce the majority of the daily range in traditional markets. In crypto, the equivalent is the first four hours after the daily candle opens on your exchange (usually midnight UTC). This indicator compares the range expansion in the first half of the day versus the second half, letting you see whether the current day's move happened early (typical of trending days) or late (typical of reversal days).

pine-Morning vs afternoon range analysis
1//@version=5
2indicator("Range Expansion Analysis", overlay=false)
3
4morningSession = input.session("0000-1200", "Morning Window (UTC)")
5afternoonSession = input.session("1200-0000", "Afternoon Window (UTC)")
6tz = "Etc/UTC"
7
8inMorning = not na(time("", morningSession, tz))
9inAfternoon = not na(time("", afternoonSession, tz))
10
11var float morningHigh = na
12var float morningLow = na
13var float pmHigh = na
14var float pmLow = na
15
16if ta.change(time("D"))
17 morningHigh := na
18 morningLow := na
19 pmHigh := na
20 pmLow := na
21
22if inMorning
23 morningHigh := na(morningHigh) ? high : math.max(morningHigh, high)
24 morningLow := na(morningLow) ? low : math.min(morningLow, low)
25
26if inAfternoon
27 pmHigh := na(pmHigh) ? high : math.max(pmHigh, high)
28 pmLow := na(pmLow) ? low : math.min(pmLow, low)
29
30morningRange = nz(morningHigh - morningLow)
31pmRange = nz(pmHigh - pmLow)
32totalRange = math.max(morningRange + pmRange, 0.0001)
33morningPct = morningRange / totalRange * 100
34
35plot(morningPct, "Morning %", color.blue, 2)
36hline(50, "Equal Split", color.new(color.gray, 60))
37bgcolor(morningPct > 65 ? color.new(color.blue, 90) :
38 morningPct < 35 ? color.new(color.orange, 90) : na)

Trading implication

When the morning captures 65%+ of the daily range, the move typically continues: the early movers set the direction and late participants pile in. When the afternoon captures the majority, it often signals a reversal of the morning's move. Track this over weeks to understand your asset's daily rhythm.

Hiding Lower Timeframes

Some scripts are designed for specific timeframes and produce misleading results on others. A session breakout tool built for the 5m chart is useless on the weekly. PineScript provides the timeframe.period variable and helper functions to restrict when your script runs.

pine-Restricting script to valid timeframes
1//@version=5
2indicator("Session Tool", overlay=true)
3
4// Convert timeframe to approximate minutes for comparison
5tfMinutes = switch
6 timeframe.isseconds => timeframe.multiplier / 60
7 timeframe.isminutes => timeframe.multiplier
8 timeframe.isdaily => timeframe.multiplier * 1440
9 timeframe.isweekly => timeframe.multiplier * 10080
10 timeframe.ismonthly => timeframe.multiplier * 43200
11 => 0
12
13// Only run on intraday charts (60 min or less)
14validTF = tfMinutes > 0 and tfMinutes <= 60
15
16if not validTF and barstate.islast
17 label.new(bar_index, close,
18 "This indicator requires a 1H or lower timeframe",
19 color=color.new(color.red, 20), textcolor=color.white,
20 style=label.style_label_left, size=size.normal)
21
22// Guard all logic behind the validTF check
23prevDayHigh = validTF ? request.security(syminfo.tickerid, "D",
24 high[1], lookahead=barmerge.lookahead_on) : na
25prevDayLow = validTF ? request.security(syminfo.tickerid, "D",
26 low[1], lookahead=barmerge.lookahead_on) : na
27
28plot(prevDayHigh, "PDH", color.new(color.red, validTF ? 20 : 100), 2, plot.style_stepline)
29plot(prevDayLow, "PDL", color.new(color.green, validTF ? 20 : 100), 2, plot.style_stepline)

Referencing Lower Timeframes Safely

When you use request.security() to fetch a timeframe lower than your chart, PineScript only returns the value at the close of each of your chart's bars, not every lower-timeframe bar within it. This means you miss most of the lower-TF data. Understanding this limitation prevents common mistakes.

Pitfall #1: Missing dataOn a 1H chart requesting "5" data, you only see 1 of the 12 five-minute bars per hour. The other 11 are invisible.
Pitfall #2: False signalsA "5m RSI crossover" detected on a 1H chart will miss most crossovers because you only check RSI at the close of each hour.
Pitfall #3: RepaintingLower-TF data can change mid-bar because multiple lower-TF bars complete while your chart bar is still open.
Safe alternativeUse request.security_lower_tf() to get an array of intrabar values. Or simply chart the lower timeframe directly.
Best practiceOnly use request.security() to fetch HIGHER timeframes. For lower-TF data, switch your chart to that timeframe.

Session High/Low Tracking and Visualization

Tracking the developing session high and low as it builds throughout the day is a core technique for intraday traders. Unlike the previous day's static levels, these are dynamic: the high ratchets up as price makes new highs, and the low drops as price makes new lows. Visualizing this building range shows you exactly how much of the expected daily range has been captured.

pine-Developing session high/low with ATR projection
1//@version=5
2indicator("Session H/L Tracker", overlay=true)
3
4atrLen = input.int(14, "ATR Length (Daily)")
5
6dailyATR = request.security(syminfo.tickerid, "D",
7 ta.atr(atrLen)[1], lookahead=barmerge.lookahead_on)
8dayOpen = request.security(syminfo.tickerid, "D",
9 open, gaps=barmerge.gaps_off)
10
11// Track developing session high and low
12var float sessHigh = na
13var float sessLow = na
14
15if ta.change(time("D"))
16 sessHigh := high
17 sessLow := low
18else
19 sessHigh := math.max(nz(sessHigh, high), high)
20 sessLow := math.min(nz(sessLow, low), low)
21
22sessRange = sessHigh - sessLow
23rangePct = dailyATR > 0 ? sessRange / dailyATR * 100 : 0
24
25// ATR-projected targets from the day open
26projHigh = dayOpen + dailyATR * 0.5
27projLow = dayOpen - dailyATR * 0.5
28
29plot(sessHigh, "Session High", color.new(color.red, 20), 2, plot.style_stepline)
30plot(sessLow, "Session Low", color.new(color.green, 20), 2, plot.style_stepline)
31plot(projHigh, "ATR Proj High", color.new(color.red, 60), 1, plot.style_circles)
32plot(projLow, "ATR Proj Low", color.new(color.green, 60), 1, plot.style_circles)

Complete Build: Session Breakout Trading Tool

This is a complete session breakout system with entries, stops, and targets. It draws the previous day's range, detects breakouts with volume confirmation, calculates ATR-based stops and targets, and displays a compact status table. Apply it to BTCUSDT or ETHUSDT on the 5m or 15m chart for intraday breakout trading.

pine-Session breakout trading tool (complete)
1//@version=5
2indicator("Session Breakout System", overlay=true, max_labels_count=50)
3
4atrMult = input.float(1.5, "Stop ATR Multiple", step=0.1)
5rrRatio = input.float(2.0, "Reward/Risk Ratio", step=0.1)
6volMult = input.float(1.5, "Volume Confirm Multiple", step=0.1)
7
8// Previous day levels (non-repainting)
9[pdHigh, pdLow, pdClose] = request.security(syminfo.tickerid, "D",
10 [high[1], low[1], close[1]], lookahead=barmerge.lookahead_on)
11dailyATR = request.security(syminfo.tickerid, "D",
12 ta.atr(14)[1], lookahead=barmerge.lookahead_on)
13
14midpoint = (pdHigh + pdLow) / 2
15avgVol = ta.sma(volume, 20)
16highVol = volume > avgVol * volMult
17
18// Breakout state tracking
19var int tradeDir = 0 // 1 = long, -1 = short, 0 = flat
20var float entryPrice = na
21var float stopPrice = na
22var float tpPrice = na
23
24// Reset on new day
25if ta.change(time("D"))
26 tradeDir := 0
27 entryPrice := na
28 stopPrice := na
29 tpPrice := na
30
31// Breakout entries (only one per day)
32if tradeDir == 0
33 if close > pdHigh and highVol and barstate.isconfirmed
34 tradeDir := 1
35 entryPrice := close
36 stopPrice := close - dailyATR * atrMult
37 tpPrice := close + dailyATR * atrMult * rrRatio
38 label.new(bar_index, low, "LONG",
39 color=color.green, textcolor=color.white,
40 style=label.style_label_up, size=size.tiny)
41 if close < pdLow and highVol and barstate.isconfirmed
42 tradeDir := -1
43 entryPrice := close
44 stopPrice := close + dailyATR * atrMult
45 tpPrice := close - dailyATR * atrMult * rrRatio
46 label.new(bar_index, high, "SHORT",
47 color=color.red, textcolor=color.white,
48 style=label.style_label_down, size=size.tiny)
49
50// Level plots
51plot(pdHigh, "PDH", color.new(color.red, 20), 2, plot.style_stepline)
52plot(pdLow, "PDL", color.new(color.green, 20), 2, plot.style_stepline)
53plot(midpoint, "Mid", color.new(color.gray, 50), 1, plot.style_stepline)
54
55// Active trade levels
56plot(tradeDir != 0 ? entryPrice : na, "Entry",
57 color.new(color.white, 20), 1, plot.style_cross)
58plot(tradeDir != 0 ? stopPrice : na, "Stop",
59 color.new(color.red, 20), 1, plot.style_cross)
60plot(tradeDir != 0 ? tpPrice : na, "Target",
61 color.new(color.green, 20), 1, plot.style_cross)
62
63// Status table
64if barstate.islast
65 t = table.new(position.bottom_right, 2, 4,
66 bgcolor=color.new(#0d0b14, 10),
67 border_width=1, border_color=color.new(color.gray, 70))
68
69 table.cell(t, 0, 0, "Status", text_color=color.gray, text_size=size.small)
70 statusText = tradeDir == 1 ? "LONG" : tradeDir == -1 ? "SHORT" : "FLAT"
71 statusCol = tradeDir == 1 ? color.green : tradeDir == -1 ? color.red : color.gray
72 table.cell(t, 1, 0, statusText, text_color=statusCol, text_size=size.small)
73
74 table.cell(t, 0, 1, "Entry", text_color=color.gray, text_size=size.small)
75 table.cell(t, 1, 1, tradeDir != 0 ? str.tostring(entryPrice, "#.##") : "-",
76 text_color=color.white, text_size=size.small)
77
78 table.cell(t, 0, 2, "Stop", text_color=color.gray, text_size=size.small)
79 table.cell(t, 1, 2, tradeDir != 0 ? str.tostring(stopPrice, "#.##") : "-",
80 text_color=color.red, text_size=size.small)
81
82 table.cell(t, 0, 3, "Target", text_color=color.gray, text_size=size.small)
83 table.cell(t, 1, 3, tradeDir != 0 ? str.tostring(tpPrice, "#.##") : "-",
84 text_color=color.green, text_size=size.small)

Indicator, not strategy

This is an indicator(), not a strategy(). It marks entries and calculates levels, but it does not simulate trades or produce backtest results. To validate the edge, convert the logic to a strategy using strategy.entry() and strategy.exit(), then run it against BTCUSDT 15m data with realistic commission (0.075%) and slippage (2 ticks).

Put this lesson to work

Free on Thrive, no account needed.