Strategy · Pine Script v5 · Own pane

BuySell Volume Strategy

by mrgunkin

This strategy compares current bar volume and price direction against the previous bar using a lookback period.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code40
Settings2inputs
LicenceMIT
Last update1 year ago6 Mar 2025

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

40 lines of Pine Script v5 from BuySell vol strategy/BuySell vol strategy.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

BuySell vol strategy.pine
//@version=5
strategy("BuySell vol strategy", overlay=false, initial_capital=3000, currency=currency.USD, default_qty_type=strategy.cash, default_qty_value=1000, pyramiding=3, commission_value=0.1)
// отключение шортов
strategy.risk.allow_entry_in(strategy.direction.long)
// аргументы
lookback = input(13)
tickername = syminfo.tickerid
p2 = close
v2 = volume
p1 = p2[lookback]
v1 = v2[lookback]
bc=input(true, 'Bar Coloring')

// расчеты
// цвета объемов
iff_1 = p2 < p1 and v2 > v1 ? #4CAF50 : #B2B5BE
iff_2 = p2 < p1 and v2 < v1 ? #B2B5BE : iff_1
iff_3 = p2 > p1 and v2 < v1 ? #B2B5BE : iff_2
z = p2 > p1 and v2 > v1 ? #FF5252 : iff_3
bc_color = z


//фильтр объемы и биржа
b1 = if tickername == 'INDEX:BTCUSD'
    timeframe.period == '1' ? 200 : timeframe.period == '3' ? 300 : timeframe.period == '5' ? 500 : timeframe.period == '15' ? 850 : timeframe.period == '30' ? 2000 : timeframe.period == '60' ? 3200 : timeframe.period == '120' ? 6500 : timeframe.period == '240' ? 10000 : timeframe.period == 'D' ? 35000 : na
else
    na

//стратегия
buy=p2 < p1 and v2 > v1 and v2 > b1
sell=p2 > p1 and v2 > v1 and v2 > b1
if buy
    strategy.entry("Long", strategy.long)
if sell
    strategy.entry("Short", strategy.short)
    
// вывод на экран
plot(v2, style=plot.style_columns, color=z)
plot(b1, color=color.new(color.orange, 40), linewidth=3)
barcolor(bc ? bc_color : na)

Overview

BuySell Volume Strategy plots colored volume columns in a separate pane to visualize bullish or bearish volume trends and draws a liquidation level threshold line. Long entries trigger when price falls with volume exceeding the threshold, while short entries trigger on rising price with high volume. The bar coloring option enables visual bar highlighting. Main settings adjust the comparison window and toggle colors. It holds positions across signals with no stop loss and supports pyramiding.

Details

Published by

mrgunkin on GitHub

Type

Strategy, Pine Script v5

Draws

Separate pane below the chart

Category

Volume, Support & resistance

Markets

Crypto

Timeframes

Any timeframe

Risk Notes

  • The strategy can add several entries in the same direction
  • The strategy enters trades without a stop loss

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
lookbackint13lookback
Bar Coloringbooltruebc
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

106 stars

This strategy plots a volume-weighted average price, Bollinger Bands built on that VWAP, a 200-period simple moving average, and Fibonacci pivot levels in a separate pane. It opens a long position when VWAP crosses above the band basis and the close is at or a

Strategy v4 Volatility & bandsSupport & resistance
Updated 2 years ago · GPL-3.0 GitHub repository of BBofVWAP with entry at Pivot Point
257 stars

This overlay strategy is built for ES futures on the one-minute chart. It plots a volume-weighted moving average of price opens and standard-deviation bands at Fibonacci ratios, plus a second longer volume-weighted average from a higher-timeframe open. Call an

Strategy v5 Volatility & bandsMoving averages
Updated 6 weeks ago · None stated GitHub repository of ES Futures 1M No Repaint
7 stars

Calculates volume profile levels over a lookback window to identify support, resistance, and Point of Control (POC) lines on the price chart. It executes trades based on price interaction with these low-volume zones, featuring customizable signal inversion and

Strategy v6 ScalpingVolume
Updated 1 year ago · None stated GitHub repository of Enhanced NQ1 Scalping Strategy

Wyckoff Phase

by muammeryldrm42
7 stars

This strategy identifies Wyckoff consolidation ranges directly on the price chart to trade potential spring and upthrust events. It calculates highest highs and lowest lows over a customizable lookback period, filtering setups by average volume spikes and ATR

Strategy v5 SMC / ICT / price actionSupport & resistance
Updated 3 months ago · MIT GitHub repository of Wyckoff Phase

This strategy combines volume surge detection, Fibonacci retracements, moving averages, and ATR volatility for trade execution. Long positions trigger when price exceeds the 0.618 Fibonacci level, price stays above a 200-period SMA, a fast EMA crosses above a

Strategy v5 TrendMoving averages
Updated 1 year ago · MIT GitHub repository of Optimized Volume + Fibonacci + Trend + ATR Strategy
3 stars

Psychological Levels is a price-chart strategy that draws quarter, half, and whole rounded price levels. A rounding value sets the level spacing, and each level type can be toggled with its own color, line style, and width. Buy and sell volume thresholds, a pr

Strategy v5 Support & resistanceVolume
Updated 5 months ago · None stated GitHub repository of Psychological Levels

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers