Adaptive Mean + σ Bands — Trader Guide

σ (sigma) family · Pine v6 · TradingView
v5.10 · with useBarLog

0. Big picture — read this first

The rest of this guide uses trader vocabulary — basis, sigma, regime, coil, backside, wave-5, ladder, ATR. This section teaches all of those in plain English so the rest of the guide clicks. If you already trade actively, skim it. If you don't, spending five minutes here will save you an hour of confusion later.

What this indicator does, in one sentence

It watches a stock's price, decides which of a few very specific patterns is currently on the chart (a coil, a break-out, a stretched move, or nothing worth trading), and prints simple go long / go short / hold / wait / cover instructions on the chart with a matching JSON alert.

The mean (we call it the "basis")

Every stock has a moving average price — the middle of where it's been trading. Think of it as the stock's gravity line or its fair price. Price stretches away from it, then usually snaps back. Different timeframes need different means:

One idea, three zooms. This is the "adaptive" in the indicator's name — the mean adapts to your chart.

Sigma (σ) — the "normal wiggle"

Prices don't sit exactly on the mean. They wiggle around it. Sigma is a number that measures how much price typically wiggles — small for calm stocks, big for volatile stocks. Statisticians call this "standard deviation," but a trader can just think of it as "the typical range price stays in."

Every band on the chart is a fixed multiple of sigma away from the mean:

Coil → expansion — the spring metaphor

Markets alternate between two states: they either coil (bands tighten, price wiggles in a narrow range — a spring compressing) or expand (bands widen, price breaks out in a direction — the spring releasing).

Those four words are the "regime" — the market's current mood. The status table's Regime row tells you which one you're in right now.

The trend has waves — Elliott and Wave 5

A very old idea (Elliott Wave theory, 1930s) says trends don't move in one clean line — they move in five pushes. Three big pushes in the trend direction (waves 1, 3 and 5) with two pull-backs in between (waves 2 and 4). By the time the fifth push arrives, buyers (or sellers) are exhausted.

You don't need to count waves to trade this indicator. What you DO need to know: the fifth push often ends when price stretches all the way to ±2σ and then closes back inside. That's the "wave-5 fingerprint" the engine uses to close an open trend trade with a WAVE5 exit (see §6 for the full explanation).

Plays and Fades — two ways to make money

Every trade this indicator opens is one of two flavors:

The engine knows which is which, sizes your position for you, sets your stop and target, and manages the trade until it closes.

Backside — the "reversal phase"

After a big trend push, the market often reverses HARD before finding a new balance. The reversal phase is called the backside. Backside trades are fades — you're betting the exhausted trend will snap back to the mean.

The engine only takes backside trades when three things line up: you've enabled the backside role for that direction, price has stretched past ±2σ, AND a "measured move" gate has cleared (the earlier coil's projected target has been reached). If all three pass and price closes back inside ±2σ, backside fires.

The Ladder — how the engine takes profit

When a trade opens, the engine doesn't wait for one big target. It scales out in stages:

This is the "ladder" you'll see mentioned in tooltips and labels — three steps down, not one big all-or-nothing exit.

Trader vocab cheat-sheet

TermPlain English
BasisThe mean — the middle price we measure everything from.
σ (sigma)The typical wiggle. The bands are 0.5, 1, 2 and 3 sigmas from the mean.
BW %ileBandwidth percentile — low = the bands are tight (coiling); high = wide (spent).
ATRAverage True Range — a normal day's total range. The stop distance and target distances are measured in ATRs.
ROne "R" = the dollars you had at risk on the trade. +2R = you doubled your risk. −1R = you got stopped out.
RegimeThe market's current mood: COMPRESSION, EXPANSION UP/DN, OVEREXTENDED UP/DN, BALANCE.
PlayA trade that goes with the trend.
FadeA trade that goes against a move that's stretched too far.
LadderThe scale-out plan for taking profit in stages (T1 / T2 / remainder).
CoverClose a position. Usually said about closing a trend trade before it reverses.
Wave 5The final push of a trend before the reversal. This indicator's WAVE5 rule closes trend trades on the wave-5 fingerprint.
BacksideThe reversal phase after a big trend push. Where fades live.
RailThe 50-minute moving average. In a trend, price pulls back to the rail and then continues.
PDH / PDLPrior day's high / low. Common breakout / breakdown reference points.
VWAPVolume-weighted average price. Today's fair price weighted by how much traded there. The purple line on intraday charts.
You now know enough vocabulary to read the rest of this guide. If a term shows up later that isn't here, hover the corresponding table cell in TradingView — every metric has a detailed tooltip that explains itself.

1. What it is

Adaptive Mean + σ Bands is a single-engine indicator that ties three ideas together on any timeframe: an adaptive basis (the mean price is measured from), a σ (sigma) band ladder around that mean, and a compression / expansion regime engine that turns those two into concrete trade signals.

The basis auto-switches with the chart's timeframe:

TimeframeBasisσ source
Under 30 minutes (execution)Today's session VWAP (purple)Volume-weighted σ around VWAP
30-minute to under 1-day (setup)True 5-day moving average (gold)Rolling σ of price around it
1-day and above (position)True 20-day moving average (gold)Rolling σ of daily prices

The engine, alerts, table and trade logic are identical across all three — only the basis differs. That is the "adaptive" idea: one grammar, three zooms.

Who it's for: traders who want the same coil-break-continuation-fade playbook to work whether they are day-trading a 2-minute chart, swing-trading a 65-minute setup, or holding a daily position. It replaces four indicators with one.

2. Install & first run

  1. Open TradingView → Pine Editor (bottom of the chart).
  2. File → Open script → paste the contents of Adaptive_Mean_Std_Dev_Bnads_V5.10-with-useBarLog.txt.
  3. Click Save (name it whatever you want — the Pine internally calls itself "Adaptive Mean + σ Bands [jdomino2]").
  4. Click Add to chart.
  5. If you see 8 warnings about ta.crossover / ta.lowest / ta.highest — those are pre-existing consistency hints, not errors. The script runs fine.

First-run sanity check

Open the settings dialog and confirm:

You should see: the purple session VWAP with green/red/gray σ bands, a gold basis line, a red fast-rail line, and the two tables in the top-right + bottom-right corners.

3. Reading the chart

The basis (gold, thick)

Everything is measured from this line. On <30 min charts it's the session VWAP (purple). On 30 min – 1 day it's the true 5-DMA (gold). On daily+ it's the 20-DMA. A daily close crossing back through it is what arms a Play (see §6).

The σ bands

Four ladder tiers, each a fixed number of standard deviations from the basis: ±0.5σ, ±1σ, ±2σ, ±3σ. The multipliers are hard-coded; only the visibility per tier is a toggle. What CHANGES is the palette — the execution frame (<30m) and the setup/position frame (30m+ / daily) intentionally use different colors so you can tell at a glance which mode the chart is in.

Execution frame (<30m — basis is session VWAP)

TierColor / styleWhat it means
±0.5σGreen solidThe normal band. Price mostly lives here in balance.
±1σDark blue dotted (circles)First stretch. A ladder step and a Play-1 pull-in reference.
±2σRed solidThe fade line. Beyond here, extended. Backside setups arm here.
±3σDark green solidExtreme. Never chase; fade only.

Setup / position frame (30m+ — basis is 5-DMA or 20-DMA)

TierColor / styleWhat it means
±0.5σOrange (45% transparent)The normal band. Price mostly lives here in balance.
±1σGray solidFirst stretch. A ladder step and a Play-1 pull-in reference.
±2σPink / rose (#c2185b)The fade line. Beyond here, extended. Backside setups arm here.
±3σDark green solidExtreme. Never chase; fade only.
On the ladder: "T1" (the first ladder step where 30% comes off) is configurable via the Trend-trade target input — the default is the 2σ band for trend/expansion trades, and Play 1's own T1 rides the fast rail / +1σ. So the "target 1" label on your chart may sit at the ±1σ or ±2σ band depending on the setup that fired.
Right-edge tags you may see: +3σ, +2σ, +1σ, -1σ, -2σ, -3σ — the on-chart line-name tags for each band. PDH / PDL — prior day high / low (see §12 troubleshooting for the lookahead fix if these look one day stale). T1σ / T2σ — the current trade's target price, drawn as its own line while a trade is open.

The fill between the ±0.5σ and ±1σ pairs shades the "normal" zone. A fat band means volatility is high; a compressed band means the coil is set — that's the BW %ile row of the table making itself visible.

The VWAP layer (intraday only)

The moving-average family

Three 30-minute-normalized MAs (7 / 17 / 33) draw on any intraday frame — same real line whether the chart is 2m or 30m. Five daily MAs (5 / 10 / 20 / 50 / 200) draw on intraday + daily. All labeled at the right edge.

The fast rail (red, w2)

A 50-minute duration MA that acts as the trend rail on the execution frame. Play 1 pull-ins reference it; the state cloud shades from it.

The MA state cloud

The cloud between price and the fast rail is color-coded:

4. The status table

The top-right table is your instrument panel. Every cell has a short tooltip (one-line trade read) and a detailed tooltip (what it is, how it's calculated, what to do). Toggle detailed tooltips with the Detailed tooltips input in the Display group.

Row 1 · BW %ile (Bandwidth Percentile)

Current bandwidth (upper 2σ − lower 2σ) ÷ basis × 100, expressed as its percentile over the last 20 sessions. Low = coiled and about to expand; high = already expanded.
GO LONG · BASE_BREAK_L or Play 1 fire from LOW BW %ile (typically < 20) as the coil expands upward. GO SHORT · same, expanding downward. HOLD · an open trade taken out of low BW %ile has room to run while the band widens. WAIT / AVOID · high BW %ile (> 80) with no direction. The compression that pays already happened. EXIT · not directly — BW %ile is a setup filter, not a trigger.

Row 2 · RVOL (Relative Volume)

Today's cumulative volume ÷ the 20-day average at this same time-of-day. Above 1 = busier than usual; above 2 = notably so. A ✓ appears when the setup's volume filter is satisfied.
GO LONG · PDH break / expansion long is stronger with RVOL ≥ 1.2 (the ✓ appears). GO SHORT · mirror. HOLD · watch for RVOL fading below 1 — momentum is leaving. WAIT / AVOID · expansion attempts with RVOL < 1 tend to fizzle. EXIT · informational only.

Row 3 · C / E (Compression / Expansion state)

Combines BW %ile and band position into one word. COIL = very tight BW. BASE = defined range within the coil. EXPANSION = price closed beyond ±1σ AND bandwidth is widening.
GO LONG · look for the COIL → EXPANSION UP transition. Play 1 and BASE_BREAK_L both trigger from here. GO SHORT · COIL → EXPANSION DN. Play 1 short / BASE_BREAK_S. HOLD · a trade taken from COMPRESSION is protected by wider bands as it expands. WAIT / AVOID · chop days sit in '-' for hours. Don't force setups. EXIT · not directly.

Row 4 · Basis slope

Direction of the basis (RISING / FALLING / FLAT), thresholded so it doesn't flicker on noise. RISING = long bias; FALLING = short bias; FLAT = balance / range.
GO LONG · only take LONGS when slope is RISING or FLAT. Never buy a stern-sinking-ship. GO SHORT · only take SHORTS when slope is FALLING or FLAT. HOLD · an open long is safest while slope stays RISING. A flip to FALLING is a warning. WAIT / AVOID · FLAT slope + high BW %ile = chop. Don't fade a flat mean. EXIT · not by itself — slope is a filter, not an exit trigger.

Row 5 · Regime

A single label that summarises where we are in the cycle:
  • COMPRESSION — coiled, waiting for the break.
  • BASE_FORMING — defined range, tighter than random compression.
  • EXPANSION UP / DN — trending outside the bands.
  • OVEREXTENDED UP / DN — beyond ±2σ with the ladder past the fade level.
  • BALANCE — mean-reverting, mid-band, no directional edge.
GO LONG · EXPANSION UP or the COIL → EXPANSION UP transition. BASE_FORMING → BASE_BREAK_L. GO SHORT · EXPANSION DN, BASE_BREAK_S mirror. HOLD · an open trade with regime in your direction. HOLD until the ladder pays or regime flips. WAIT / AVOID · BALANCE regime = no edge. OVEREXTENDED = fade setup, not chase setup. EXIT · on regime change AGAINST an open trade (EXPANSION UP → BALANCE while long = warning; → EXPANSION DN = exit).

Row 6 · Flag

An engine-generated sentence combining regime + band ext + rail state + backside status. Reads like plain English:
  • "balance" — no directional edge, chop day.
  • "TREND UP — ride with VWAP" — clean uptrend, use pullbacks to VWAP/rail.
  • "COIL — break PDH / reclaim VWAP" — set up ready, waiting for trigger.
  • "NO NEW LONGS — fade / wait re-entry" — extended up, don't chase.
GO LONG · read the flag. If it says LONG or ride-up / break PDH, and C/E confirms, take the setup. GO SHORT · if the flag says SHORT or NO NEW LONGS / fade, take the mirror setup. HOLD · as long as the flag hasn't flipped against your trade. WAIT / AVOID · any flag containing 'wait', 'no', 'avoid', or 'balance' — stand down. EXIT · when the flag flips against an open trade AND C/E confirms — that's a real regime shift.

Row 7 · Trade

Current trade state at a glance:
  • FLAT — no open trade, ready to fire.
  • LONG / SHORT + type code — you're in a trade. Type codes:
    • CL/CS — CONT long/short (continuation)
    • EL/ES — Expansion
    • VL — VWAP Play 1
    • PL/PS — Pullback long/short
    • BL/BS — BASE_BREAK long/short
    • BBL/BBS — Backside long/short
  • PAUSED longs / shorts / both — a risk gate has blocked entries on that side.
  • EXTENDED UP/DN — no chase / no adds.
GO LONG · wait until FLAT + flag is a long setup, then take it. Never add to PAUSED. GO SHORT · same in reverse. HOLD · while the cell shows LONG/SHORT + type, HOLD it, work the ladder, respect the stop. WAIT / AVOID · PAUSED = risk gate is active. Do not override manually. EXIT · on ladder events (T1/T2/full close), stop-out, or opposite-side regime flip.

Row 8 · Entry × Qty

The entry price + share count + dollar risk at fill. Sizing: shares = floor(risk$ ÷ |entry − stop|), then bounded by min/max share gates.

If cell shows '-' but the flag says GO: the setup was skipped by a share-count gate — usually the stop was too wide (check Risk / Size row).

Row 9 · Stop / Tgt

The two absolute prices bounding the trade. STOP = structure (VWAP-Play hold low, BASE_BREAK box, PDH break bar low), capped at 2.0 × daily ATR. TARGET = the ±1σ or ±2σ band where the ladder takes off (T1: 30% off; T2: 50% at basis/rail; remainder trails).

Row 10 · R : R

(target − entry) ÷ |entry − stop|. A 2.0R setup means the first target is twice as far as the stop. Below 1.0R = poor risk/reward.
GO LONG · prefer setups where this shows ≥ 1.5R. GO SHORT · same threshold in reverse. HOLD · high R:R has ladder room. HOLD while the picture holds. WAIT / AVOID · if a proposed setup would show R:R < 1.0, the flag will say 'skip' or 'wait'. Trust that. EXIT · no direct exit — R:R is a setup-quality read.

Row 11 · Last (W-L-S)

Last completed trade (entry-type + exit reason + R multiple + $ P&L) followed by session win-loss-scratch count. W = closed above 0R. L = closed below 0R (includes STOP EXIT). S = closed within ±0.1R (scratch).

Row 12 · Risk / Size

The risk per trade and the share bounds that gate entries. Risk $ is either fixed or a % of a declared account. min/max sh = if the sized share count falls outside min or max, the trade is SKIPPED (no phantom fill).
If trades keep skipping: check whether min/max is too tight for the current stop distance.

Row 13 · Backside

Backside fades (2σ re-entry mean-reversion setups). Two independent states:
  • Role = OFF / long / short / both. Off HIDES all backside labels + trades.
  • Armed = TRUE when price has printed ≥ ±2σ AND the measured-move gate has cleared AND we're waiting for the 2σ re-entry close.

Backside trades: BACKSIDE L (after −2σ excursion → close back inside triggers a LONG, target = mean, stop = extreme). BACKSIDE S = mirror. WAVE5 covers use the raw re-entry regardless of role/gates.

5. Signal labels

TRADE vs INFO markers (v5.10 split)

Every marker on the chart is either a TRADE event (a real entry, exit or ladder step) or an INFO event (context — coil, armed, PDH, warning-only fade).

To hide diagnostics only, toggle Show informational markers in the Display group. Real entries and exits remain visible.

Label styles

Signal labels input has three modes:

Line-name tags

Label plotted lines (default OFF) pins a tiny name tag on the right of each visible overlay (basis, σ bands, VWAPs, rail, PDH/PDL, MM, open-trade plan). Hover for a short explanation. Labels only appear for lines actually drawn on the current frame.

6. Trade engine

Play 1 · VWAP pull-in long (execution frame)

The canonical J3P trade. Structure:

  1. Reclaim — price crosses the VWAP from below and holds a bar close above it.
  2. Ride — must travel at least vpLeg × ATR above the VWAP before pull-in counts.
  3. Pull-in — retraces to the VWAP (or the fast rail — whichever is closer, "the nearest rail").
  4. Hold — a defined consolidation forms at the pull-in.
  5. Break — price breaks the consolidation high → ENTRY. Stop = the hold low. Ladder: T1 = the 30-minute high or ±1σ band (30% off). T2 = the fast rail turn (50% off). Remainder trails the basis.

Alt trigger: Fashionably Late — a flush below the hold low that closes back above VWAP. The failed shakeout is the entry, at the low, stop under the flush bar.

Play 2 · PDH / PDL break (continuation)

An armed coil + a bar close above yesterday's high (or below yesterday's low) fires an ENTRY. Fires only during COMPRESSION or the two bars immediately after (so a stale coil doesn't retrigger).

PULLBK L/S · Trend pullback

Above VWAP with rail rising + at least pbRideBars bars of ride → price tags the rail → closes back over it through the prior 2-bar high → ENTRY long. Mirrored for shorts.

BASE_BREAK L/S · Base break

A BASE_FORMING regime + a bar close outside the defined box high/low → ENTRY. Uses the box edge as the stop reference.

Backside L/S · 2σ mean-reversion fade

Requires Backside role = long / short / both AND the armed gate AND the measured-move gate. Triggers when price closes back inside ±2σ after a ≥ ±2σ excursion. Target = the mean. Stop = the extreme.

WAVE5 · the "trend is exhausted" exit

Not a new trade. It's a rule that closes a trade you already have when the trend that carried you gets to a signal that says "the last push is over."

The 30-second version of "Wave 5": a very old trading idea says trends move in five pushes — three big pushes in the trend direction (waves 1, 3 and 5) with two pull-backs in between (waves 2 and 4). Wave 5 is the final push before the trend runs out of gas and reverses. Traders who catch that reversal do well; traders still holding the trend get hurt. This indicator watches for a very specific fingerprint of that "final push and rollover" and covers your open trade before the reversal hurts you.

What the indicator watches for

Every trend push tends to end at an extreme: price stretches all the way out to the ±2σ band. When price then closes back inside ±2σ, that's the reversal fingerprint — the extreme was tagged and price turned around.

The rule is one line: if you have a trend-following trade open and price makes a 2σ re-entry against the direction of your trade, cover it now.

The W5 label on the chart

When it fires, a small W5 marker is drawn at the exit bar. Hover it and you'll see:

TRADE EXIT — CONT L
WAVE5   -.13R   -$12.83
285 sh  @ 92.91

Read it as: "the engine closed your CONT L (Continuation Long) trade on the WAVE5 rule. You gave back 0.13R ($12.83 on 285 shares) at $92.91." A small give-back on a wave-5 exit is normal — the whole point is to cover before the reversal deepens, not to squeeze the last penny.

Why it's separate from Backside

Backside fadeWAVE5 cover
PurposeENTER a new trade against the trendEXIT a trade that was riding the trend
Trigger2σ re-entry and role/gates all pass2σ re-entry, no gates required
Direction of the resulting tradeFresh position, opposite to the pushJust flat — no new position

Same market fingerprint, two different jobs. Backside is trying to make money on the reversal; WAVE5 is trying to protect the money you already made (or limit the give-back on a trend trade that's overstayed).

What "raw" means

The re-entry can be as simple as one bar closing back inside — no confirmation delay, no measured-move gate, no backside role check. That's on purpose: an exit should never be starved by filters that were designed for entries. Missing a small exit turns into a big loss; missing a small entry just means the next setup.

Exit logic

ReasonTrigger
STOPConfirmed close through the stop (or intra-bar hit, per config).
TARGETT1 hit → 30% off. T2 hit → 50% off. Remainder trails.
TIMETrade age exceeds tradeMaxBars and hasn't triggered T2.
WAVE5Price tagged ±2σ then closed back inside against your open trade's direction — trend push spent, cover before the reversal (see subsection above).
REVERSEA new setup fires in the opposite direction with regime confirming.
PREEMPTFull close before T2 (used when a fade turns into a trend).

7. Regime & flag state machine

The Regime state drives what the Flag says, which drives what the DO THIS row (if enabled) says. The full transition table:

FromConditionToWhat fires
BALANCEBW %ile drops below coil thresholdCOMPRESSIONCOMPRESSION_START signal
COMPRESSIONRange defines (equal highs/lows)BASE_FORMINGBASE_FORMING signal
BASE_FORMINGClose outside box + regime OKEXPANSION UP/DNBASE_BREAK_L/S entry
COMPRESSIONClose beyond ±1σ + BW risingEXPANSION UP/DNEXPANSION_UP/DN signal (+ PDH/PDL long/short if armed)
EXPANSIONClose beyond ±2σ + measured-move gate clearOVEREXTENDEDOVEREXTENDED_UP/DN signal (+ backside arms)
OVEREXTENDEDClose back inside ±2σEXPANSION or BALANCEBACKSIDE fade fires (if role permits)
EXPANSIONClose back through the basisBALANCEEXPANSION_END regime-change marker

The Flag is a one-line rendering of the current state + one hop ahead:

8. Sizing & risk

Every entry sizes automatically to fit your risk mode. The formula:

shares = floor(risk$ ÷ |entry − stop|)
if shares < minShares or shares > maxShares:
    SKIP THIS TRADE  (no fill printed)

Risk mode

Share bounds

The min shares / max shares gates are "sanity brakes":

This is the Boat-style safety: no phantom fill on a stop distance the account can't accommodate.

Stop cap

Every raw stop is passed through a cap: |entry − stop| ≤ maxStopATR × dailyATR (default maxStopATR = 2.0). If the structural stop is further out, the trade is skipped entirely — an R:R this bad isn't worth taking.

9. Alerts & webhook

The wire format

Every alert fires as <wh_event_tag>|<json>. Example:

AM_EVT|{"indicator":"AM_BANDS","v":"am_v5.10","trade_id":"...","leg_id":"1","event_type":"ENTRY","entry_type":"VL","direction":"LONG","sym":"VZ","tf":"2","ts":...,"entry_px":45.61,"stop":45.38,"target":45.87,"shares":450,"risk_usd":100,...}

Setting up the TradingView alert

  1. Right-click the chart → Add alert.
  2. Condition → Adaptive Mean + σ Bands [jdomino2] → Any alert() function call.
  3. Trigger → Once Per Bar Close (matches the Pine's alert.freq_once_per_bar_close).
  4. Notifications → Webhook URL → paste your tradingview_smb_indicator_trigger.php URL.
  5. Message → leave the default {{message}}. The Pine's alert(m, ...) already sends the JSON verbatim.

Alert classes (per-toggle)

Pine Logs mirror

show_json (default ON) writes each ENTRY/EXIT payload to Pine Logs via log.info — same string the webhook receives. Turn ON when you want to see the JSON without wiring a receiver; turn OFF once you're done testing (it's chatty on active symbols).

The DB destination

Alerts land in alerts_tradingview.indicator_alerts (the same table the BOAT and FashLate engines feed). Filter your rows with:

SELECT * FROM alerts_tradingview.indicator_alerts
WHERE indicator = 'AM_BANDS'
ORDER BY datetime_ny DESC;

10. Display controls

Display modes

The engine is identical in all three — only the drawing changes.

Font size controls (v5.10 · lens-v1)

Both default to Small (matches v5.10 original). Options: Tiny · Small · Normal · Large · Huge.

Detailed tooltips

Detailed tooltips input (default ON):

Other useful toggles

11. useBarLog (lens-v1 port capture)

New in this build (2026-09-16). Emits one compact JSON row on every confirmed bar close containing the full state: OHLCV, basis, all σ bands, all VWAPs, fast rail, ATR, BW %ile, regime, flag, trade state. Used to capture golden fixtures for the lens-v1 JavaScript port.

How to capture a fixture

  1. Settings → Webhook / DB Contract group → toggle "Log PER-BAR state to Pine log" ON.
  2. Load the (symbol, date, timeframe) you want to capture.
  3. Pine Editor → Logs pane. Every confirmed bar prints one AM BAR block:
    AM BAR
    AM_EVT|{"v":"am_v5.10","sym":"VZ","tf":"2","ts":...,"open":45.60,"high":45.65,...}
  4. Select all in Logs pane → copy → save as test/fixtures/<sym>-<date>-<tf>.raw.txt in the lens-v1-dev tree.
  5. Run node test/fixtures/parse.js → produces the JSON fixture file the tests assert against.
  6. Turn the toggle OFF once you have the fixture. Extremely chatty on active symbols.
Cost: a typical intraday session on a 2m chart is 100-200 bars = 100-200 JSON rows in the Logs pane. Reasonable. On a 1-minute chart across a full year it's tens of thousands of rows — TradingView will start truncating. Capture at your target execution timeframe only.

12. Troubleshooting

"Undeclared identifier" error on compile

Almost always means a variable my tooltip or bar-log block references doesn't exist in your build. Common ones:

8 "consistency" warnings on compile

Pre-existing in the original v5.10 (nothing to do with useBarLog / tooltips). They're TradingView's cautionary hints about ta.crossover / ta.lowest / ta.highest inside conditionals. The script still runs correctly.

Table shows "session σ" when I expected "N bars"

You're on a <30-minute chart. The basis auto-switches to today's session VWAP with volume-weighted σ. Zoom out to 30m+ to see the true 5-DMA rolling σ.

The 2-Day AVWAP looks wrong on the second day of a fresh block

Known: the 2-day uses a floor-based block boundary. On the second day of a block, the anchor is 1 day old, not 2. Weekend / holiday reset. See v5.0 changelog. Function-wise, this is display only; entries and exits are unaffected.

PAUSED longs / shorts / both — how do I unblock?

Something is gating the side:

My alert isn't landing in indicator_alerts

Font size input does nothing

If Label font size = Large but on-chart labels stay tiny: check that Signal labels input is set to "Icons + tooltips" or "Verbose boxes" (not "Off"), and that INFO markers aren't the only things visible (their round-circles stay tiny by design).