NEWCard payments are live · from $18/month, USDT also acceptedSee plans
COINPRED / STRATEGY LIBRARY

BTC Price and Volume Breakout: Buy when close and volume clear a lookback high above the trend SMA

An open-source breakout strategy by tradedots (MPL 2.0). By default it is long only: it enters when the close and volume both clear the prior window highs and the close is above a trend SMA, then exits after five closes back under that average. The author's chart is BINANCE:BTCUSDT on the 4-hour timeframe. The rules follow the source; this page has no invented backtest figures.

Illustrated guidesPine Script®Included with monthly & annual plans
← All strategies
tradedots · 2.0 · 2026-11-26 · Breakouts
BTC Price and Volume Breakout: Buy when close and volume clear a lookback high above the trend SMA

The idea

This is tradedots' open-source script titled Price and Volume Breakout Buy Strategy [TradeDots]. A new high in price alone is not enough. On the same bar, the close and the volume both have to clear the highest value from their lookback windows as of the previous bar, and the close also has to sit above a longer simple moving average. The publication describes it as a fit for assets with sharp swings and sudden bursts of activity, and it mentions bitcoin and ethereum in that context. This write-up follows the source and the author's chart; it does not repeat the publication's remarks about trade counts or holding periods.

The author's publication chart is BINANCE:BTCUSDT on the 4-hour timeframe, so this entry is filed under BTC. The script is not hard-coded to one symbol; it will load on other charts, but the write-up and the image follow that publication chart. The default order direction is Long. The short branch is in the source, but it does not fire unless you change that input.

Author chart of the price and volume breakout strategy on BINANCE:BTCUSDT 4-hour, showing price, the trend average, and entry/exit marks
Author chart: BINANCE:BTCUSDT (Bitcoin / TetherUS), 4-hour timeframe, from the author's publication image. Price, the trend moving average, and breakout entry/exit marks are visible; this only shows the layout and is not evidence of performance.

How the indicators are calculated

  • Price window: price_highest = ta.highest(Price Breakout Period). In Pine v5 that form uses high, so it is the highest high in the window. The default length is 60.
  • Volume window: volume_highest = ta.highest(volume, Volume Breakout Period), using volume rather than price. The default length is also 60.
  • Trend average: a simple moving average of the close, with length Trendline Length (the input variable is misspelled input_trendline_legnth, which does not change the value), default 200. The average is plotted, and candle colors follow whether the close is above or below it.
  • A long needs all of these: close above price_highest[1], volume above volume_highest[1], close above that SMA, no open trades, and Order Direction not set to Short. The [1] offset uses the window extreme as of the previous bar, so the still-forming bar is not part of that benchmark.
  • The strategy sets initial_capital=10000, 70% of equity per entry, and a 0.01 percent commission. It does not set pyramiding, so Pine's default of 0 applies; the source also requires strategy.opentrades == 0, so it will not add to an open trade.

Entry rules

  • Long (order name Long): the price-and-volume breakout fires, the close is above the SMA, there is no open trade, and Order Direction is not Short. The script then draws a line at the broken prior high and places a Breakout Buy label near the low.
  • Short (order name Short): the close falls through price_lowest[1], volume also clears the prior window high, the close is below the SMA, there is no open trade, and Order Direction is not Long. With the default Long setting, this branch is not used.
  • A second signal in the same direction does not add size while a trade is open. The source does not wait for barstate.isconfirmed. On a 4-hour chart, whether the close has cleared the prior high can still change before the bar ends; whether a fill stands depends on your TradingView order settings.

Exits and position size

  • Exit long: the close has been below the trend SMA for five bars in a row (close through close[4]), and the most recent open trade size is greater than 0. A comment in the source says “5 consecutive days,” but the comparison is five bars, not five calendar days. On the author's 4-hour chart, that is five consecutive 4-hour closes below the average.
  • Exit short: five consecutive closes above the trend SMA, with the most recent open trade size below 0.
  • There is no separate take-profit or stop-loss. The only exit is this five-bar moving-average condition.
  • Each entry is 70% of equity. What that notional is worth changes with the symbol and equity, so treat the size as your own risk setting, not as a recommended allocation.

Inputs (source defaults)

InputDefaultRole
Price Breakout Period60Lookback for the highest high; a long needs the close to clear the prior bar's window high.
Volume Breakout Period60Lookback for the highest volume.
Trendline Length200Length of the close SMA used as a trend filter. The variable name is spelled legnth; the value is still used as written.
Order DirectionLongLong only, short only, or Long and Short.

Things to know before using it

  • It is long-only by default. The short rules apply only if you switch to Long and Short or Short.
  • The “5 consecutive days” comment does not match the code. Count five bars. That lines up with five sessions only if you run it on a daily chart.
  • There is no stop-loss. After a breakout, a deep pullback that stays above the average can leave the trade open until five closes finally slip under the SMA.
  • 70% of equity is a large fraction, and commission is set at 0.01 percent. Live costs and slippage can differ from the tester, especially on the bar where volume spikes.
  • The script recolors candles with plotcandle and may leave breakout lines and labels on the chart. That is display only and does not change the order logic.

Installing it on TradingView

  1. Download the .pine file from Coinpred (active membership required, see below), or check the original page for a newer version.
  2. Open the Pine Editor, create a blank script, paste the full source, and save.
  3. Click Add to chart. To match the author image, start with BINANCE:BTCUSDT on the 4-hour timeframe.
  4. Review the order direction, the average length, and the size in the strategy properties, then inspect fills in the Strategy Tester.
  5. Past tester results do not guarantee future returns.

About backtest figures

Source, license and version

  • Source: https://www.tradingview.com/script/jc2hs2qK-Price-and-Volume-Breakout-Buy-Strategy-TradeDots/
  • Author: tradedots (shown as TradeDots on the publication page). Source version 2.0 (Pine v5), scriptAccess=open_no_auth.
  • License: Mozilla Public License 2.0. Redistribution must keep the copyright and license notices; modified files must remain under MPL 2.0. Coinpred ships the unmodified full source.
  • Members can download the .pine file on this page to study the rules. Judge the risk yourself, and follow your venue's rules.

Source, license and version

Mozilla Public License 2.0 (MPL 2.0),源码头注明 © tradedots。再分发须保留原版权与许可声明;如修改源码文件,修改后的文件仍须按 MPL 2.0 提供。Coinpred 未修改源码。 / Licensed under MPL 2.0 per the source header, © tradedots. Redistribution must keep the copyright and license notices; modified files must remain under MPL 2.0. Coinpred ships the unmodified source.

View original source ↗

Check the script license and your TradingView account features. Historical results do not guarantee future performance.

More strategies

All strategies →