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.
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.
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.
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:
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.
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).
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.
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.
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.
| Term | Plain English |
|---|---|
| Basis | The 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 %ile | Bandwidth percentile — low = the bands are tight (coiling); high = wide (spent). |
| ATR | Average True Range — a normal day's total range. The stop distance and target distances are measured in ATRs. |
| R | One "R" = the dollars you had at risk on the trade. +2R = you doubled your risk. −1R = you got stopped out. |
| Regime | The market's current mood: COMPRESSION, EXPANSION UP/DN, OVEREXTENDED UP/DN, BALANCE. |
| Play | A trade that goes with the trend. |
| Fade | A trade that goes against a move that's stretched too far. |
| Ladder | The scale-out plan for taking profit in stages (T1 / T2 / remainder). |
| Cover | Close a position. Usually said about closing a trend trade before it reverses. |
| Wave 5 | The final push of a trend before the reversal. This indicator's WAVE5 rule closes trend trades on the wave-5 fingerprint. |
| Backside | The reversal phase after a big trend push. Where fades live. |
| Rail | The 50-minute moving average. In a trend, price pulls back to the rail and then continues. |
| PDH / PDL | Prior day's high / low. Common breakout / breakdown reference points. |
| VWAP | Volume-weighted average price. Today's fair price weighted by how much traded there. The purple line on intraday charts. |
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:
| Timeframe | Basis | σ 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.
Adaptive_Mean_Std_Dev_Bnads_V5.10-with-useBarLog.txt.ta.crossover / ta.lowest / ta.highest — those are pre-existing consistency hints, not errors. The script runs fine.Open the settings dialog and confirm:
wh_indicator = "AM_BANDS", wh_version = "am_v5.10", sendEvents = ON, sendSignals = OFF.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.
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).
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.
| Tier | Color / style | What it means |
|---|---|---|
| ±0.5σ | Green solid | The 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 solid | The fade line. Beyond here, extended. Backside setups arm here. |
| ±3σ | Dark green solid | Extreme. Never chase; fade only. |
| Tier | Color / style | What it means |
|---|---|---|
| ±0.5σ | Orange (45% transparent) | The normal band. Price mostly lives here in balance. |
| ±1σ | Gray solid | First 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 solid | Extreme. Never chase; fade only. |
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.+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.
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.
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 cloud between price and the fast rail is color-coded:
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.
✓ appears when the setup's volume filter is satisfied.CL/CS — CONT long/short (continuation)EL/ES — ExpansionVL — VWAP Play 1PL/PS — Pullback long/shortBL/BS — BASE_BREAK long/shortBBL/BBS — Backside long/shortIf 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).
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.
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).
label.style_label_up / _down and a solid fill. Hover tooltip carries E/S/T + sizing; EXIT hover carries R + $ P&L.label.style_circle and a muted fill. Hover tooltip prefixed INFO —.To hide diagnostics only, toggle Show informational markers in the Display group. Real entries and exits remain visible.
Signal labels input has three modes:
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.
The canonical J3P trade. Structure:
vpLeg × ATR above the VWAP before pull-in counts.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.
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).
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.
A BASE_FORMING regime + a bar close outside the defined box high/low → ENTRY. Uses the box edge as the stop reference.
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.
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."
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.
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.
| Backside fade | WAVE5 cover | |
|---|---|---|
| Purpose | ENTER a new trade against the trend | EXIT a trade that was riding the trend |
| Trigger | 2σ re-entry and role/gates all pass | 2σ re-entry, no gates required |
| Direction of the resulting trade | Fresh position, opposite to the push | Just 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).
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.
| Reason | Trigger |
|---|---|
| STOP | Confirmed close through the stop (or intra-bar hit, per config). |
| TARGET | T1 hit → 30% off. T2 hit → 50% off. Remainder trails. |
| TIME | Trade age exceeds tradeMaxBars and hasn't triggered T2. |
| WAVE5 | Price tagged ±2σ then closed back inside against your open trade's direction — trend push spent, cover before the reversal (see subsection above). |
| REVERSE | A new setup fires in the opposite direction with regime confirming. |
| PREEMPT | Full close before T2 (used when a fade turns into a trend). |
The Regime state drives what the Flag says, which drives what the DO THIS row (if enabled) says. The full transition table:
| From | Condition | To | What fires |
|---|---|---|---|
| BALANCE | BW %ile drops below coil threshold | COMPRESSION | COMPRESSION_START signal |
| COMPRESSION | Range defines (equal highs/lows) | BASE_FORMING | BASE_FORMING signal |
| BASE_FORMING | Close outside box + regime OK | EXPANSION UP/DN | BASE_BREAK_L/S entry |
| COMPRESSION | Close beyond ±1σ + BW rising | EXPANSION UP/DN | EXPANSION_UP/DN signal (+ PDH/PDL long/short if armed) |
| EXPANSION | Close beyond ±2σ + measured-move gate clear | OVEREXTENDED | OVEREXTENDED_UP/DN signal (+ backside arms) |
| OVEREXTENDED | Close back inside ±2σ | EXPANSION or BALANCE | BACKSIDE fade fires (if role permits) |
| EXPANSION | Close back through the basis | BALANCE | EXPANSION_END regime-change marker |
The Flag is a one-line rendering of the current state + one hop ahead:
"COIL — break PDH / reclaim VWAP""TREND UP — ride with VWAP""NO NEW LONGS — fade / wait re-entry""balance"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)
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.
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.
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,...}
Adaptive Mean + σ Bands [jdomino2] → Any alert() function call.alert.freq_once_per_bar_close).tradingview_smb_indicator_trigger.php URL.{{message}}. The Pine's alert(m, ...) already sends the JSON verbatim.sendEvents, default ON. Real trade opens and closes.sendSignals, default OFF. Informational (COMPRESSION_START, EXPANSION_UP, BASE_FORMING, etc.). Turn on if you want the full stream.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).
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;
The engine is identical in all three — only the drawing changes.
Both default to Small (matches v5.10 original). Options: Tiny · Small · Normal · Large · Huge.
Detailed tooltips input (default ON):
Mark REGIME CHANGES on price — small text tag at the bar where regime flips.Regime background tint (Clean / Stealth) — faint green/red/pink carrying the regime.State cloud on the 50-min rail — the four-color rail cloud (see §3).Show informational markers — toggle the round INFO circles (coil / armed / PDH / etc.).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.
AM BAR block:
AM BAR
AM_EVT|{"v":"am_v5.10","sym":"VZ","tf":"2","ts":...,"open":45.60,"high":45.65,...}
test/fixtures/<sym>-<date>-<tf>.raw.txt in the lens-v1-dev tree.node test/fixtures/parse.js → produces the JSON fixture file the tests assert against.Almost always means a variable my tooltip or bar-log block references doesn't exist in your build. Common ones:
volMin vs rvHot — the RVOL confirmation threshold.stopCapATR vs maxStopATR — the stop cap input.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.
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 σ.
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.
Something is gating the side:
useRegGate OFF or wait for it to turn.wh_indicator is empty → the DB indicator column will be empty. Set it in Webhook / DB Contract group.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).