Indicators · Stretch bands on the price chart · explained simply
PeakLines 1.00
Copy the full Pine script and paste it into TradingView’s Pine Editor. Or copy this explanation, open Grok, and paste it with your question.
PeakLines measures how far a fast average has pulled away from a slow one and compares that gap with its own recent history. A green triangle marks a possible buy when an unusually deep downward stretch starts to ease. A magenta triangle marks a possible sell when an unusually high upward stretch starts to ease.

Six questions this page answers
Use the guide below the same way you would judge any tool on a chart:
- What state is the market in?
- What should I do, and at exactly what price?
- How sure is it?
- What proves it wrong?
- Has it worked before on this chart?
- What can’t it tell me?
What it tells you
What state is the market in? PeakLines answers: is price unusually stretched up or down compared with its own recent past?
The script draws four slow-moving averages of each bar’s midpoint (halfway between its high and low), using 8, 16, 24 and 32 bars. The spread is the gap between the fastest (8) and slowest (32) average. By default that gap is divided by the 14-bar average true range (ATR), so a big gap on a calm chart and on a wild chart can be compared fairly.
Then it looks back over the 88 bars before this one and finds two edges. The upper band is the level only the top 4% of those spread readings beat. The lower band is the level only the bottom 8% fell below. The bands are re-figured every bar, so they adjust on their own to each chart. By default the upper band never goes below zero and the lower band never goes above zero. The bands (and so the signals) only start once there are 88 bars of spread history.
The triangles
What should I do, and at exactly what price? PeakLines works at the bar’s close. The test account fills at the closing price of the bar with the triangle.
The trigger is the turn back. A buy does not fire while the spread is still sinking below the lower band. It fires on the first bar that closes with the spread crossing back up through the lower band: the stretch is starting to ease. A sell is the mirror: the spread crosses back down through the upper band. (A setting called Trigger: Level brings back the older rule of firing on any bar outside a band.)
- Signals are only decided when a bar closes, so a triangle does not appear and then vanish during the bar.
- After a buy, another buy must wait at least 2 bars (the cooldown); sells work the same way.
- A built-in $100 test book decides which signals count: a buying run stops at 16 buys, and a sell only shows while the book is holding shares.
- Green triangle (below the bar): possible buy.
- Magenta triangle (above the bar): possible sell.
A setting can also tint the background while the spread is outside a band (off by default).
The colored ribbon
The four averages are drawn as thin lines with the area between the fastest and slowest shaded:
- Gold: all four are stacked upward in order (an uptrend).
- Blue: all four are stacked downward in order (a downtrend).
- Light gray: they are out of order, or the fast and slow ones are within 0.34% of each other (no clear trend).
The $10,000 account
Has it worked before on this chart? PeakLines runs a pretend $10,000 account on past bars, starting at the first close on or after Jan 1, 2021 (or the first bar on a shorter chart). It only buys and sells what it holds; it never bets on a drop and uses no leverage.
- Buys spend 8% of the account’s value on the first buy of a run, then 1.5 times more each buy (8%, 12%, 18%, 27%, 40.5%…), never more than the cash on hand. About five buys use up all the cash.
- Sells sell 25% of the shares held, then 1.5 times more on each sell in a row (25%, 37.5%, 56.25%), never more than 60% at once. So it never sells out completely.
- Each trade pays 0.05% commission and 0.05% slippage.
- A cycle ends when a buy comes after one or more sells. The profit or loss on what was sold is counted as a win or a loss (breaking even counts as a win).
The account follows the triangles; it never changes them.
The table
The table (bottom right by default) compares the account with simply buying $10,000 of the same chart at the same start and holding it (B&H). The top-right cell says HOLDING and how much of the account is in shares, ALL CASH, or WAITING (not started yet).
- Equity: cash plus shares at the last close. Return: that compared with $10,000.
- Real: profit or loss already booked on sales. Unrl: profit or loss on shares still held.
- MaxDD: the biggest drop from a high point, in dollars and percent. Pain$: a measure of how deep and how long drops lasted on average.
- Cash: money not invested.
- Cycle stats: PF (total winning cycles divided by total losing cycles), Win%, W/L, $/Cyc (average result per cycle), AvgW and AvgL, and Fees paid.
Hover the cells in TradingView for more detail.
With PeakLines H
PeakLines H draws the same spread and bands in a pane below the chart. With the same settings, its dots and these triangles land on the same bars.

Alerts
Pick PeakLines Buy or PeakLines Sell in TradingView’s alert dialog. They match the triangles and are decided at the bar close.
What it can’t tell you
How sure is it? PeakLines gives no confidence number. A triangle only means an unusual stretch has started to ease. What proves it wrong? There is no stop line. A buy can be followed by lower prices and more buys; a sell can be followed by higher prices.
- It does not predict prices. A stretch can ease for a bar and then stretch again.
- The bands always mark the top 4% and bottom 8% of recent bars, so some signals will show up even on a chart that is just drifting.
- It only looks at price. It ignores news, earnings and the wider market.
- The account is a test on past prices. It leaves out taxes, and real fills can be worse. The numbers change with the chart, timeframe, start date and settings. They are not anyone’s real results, and the screenshot is not a typical outcome.
- PeakLines is a TradingView indicator. It is not part of the nightly site refresh, so MystTrades does not show live PeakLines readings.
Version
PeakLines 1.00 by TheurgyLabs (build of Nov 19, 2026). This is the first price-chart version. It uses exactly the same signal rules as PeakLines H 1.11 and adds the ribbon and the $10,000 account.
For learning and research, not personal investment advice. This page explains the indicator; it does not show live readings or change your TradingView script. Any table numbers are a hypothetical test on past prices, not real trades. Past results do not promise future results.