Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Volume fight strategy

A Pine Script v5 strategy built on VWMA (bull_vol, 11) and SMA (11). It has 4 order rules, 2 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 10000 in cash and pays 0.04 commission. 5 settings; defaults include Direction ANY, Search_range 11 and Smoothing_for_flat,% 15.

Generated from the script's code by a template: every clause is a fact read from the source. Not written by a person or a model, and not taken from the author's description.

Does Volume fight strategy repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 12 of 12 trades.
How did Volume fight strategy do on BTCUSDT 1D with default settings?
+92.03%
From 26 Jan 2024 to 21 Oct 2026, over 45 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
What alerts does Volume fight strategy have?
2
Bullish movement! LONG trading zone; Bearish movement! SHORT trading zone.
Does Volume fight strategy run in Pine Script v6?
No
The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 45 before, 1 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download.
Does Volume fight strategy use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.

BTCUSDT · 1D · default settings

  • Volume difference
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (5)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctVolume difference$19,181$20,253Equity from $10,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. Lines are what the script plots.
Net profit
+92.03%
$9,203.16
Buy and hold
+102.5%
same period
Closed trades
45
14 won · 31 lost
Profitable
31.1%
of closed trades
Profit factor
1.61
gross profit ÷ gross loss
Max drawdown
24.62%
−$5,004.58

One run with the author's default settings, $10,000 starting capital, commission as the script sets it. A short position was still open at the last bar. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.

Review

What a careful reader of this script would point out, found by checking the source and the backtest.

  • Check

    No stop loss

    Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.

  • Note

    No slippage

    Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.

  • Note

    Uses an argument v6 removed

    when = on line 36, 37, 38, 39. The upgraded version below moves each call inside an if block.

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

SettingDefaultType and rangeFeeds
DirectionSelect the direction of trade.\n\nВыберите направление торговли.ANYstring · options ['LONG', 'SHORT', 'ANY']entry Long entry Short
Search_rangeThe range of estimation of the predominance of bullish or bearish volume (quantity bars). The smaller the TF, the higher the range value should be used to filter out false signals.\n\nДиапазон оценки преобладания бычьего или медвежьего объема (количество баров). Чем меньше ТФ, тем выше следует использовать значение диапазона, чтобы отфильтровать ложные сигналы.11int · min 1avg_bull_vol avg_bear_vol diff_vol
Smoothing_for_flat,%Smoothing to reduce false signals and highlight the flat zone. If you set the percentage to zero, the flat zones will not be highlighted, but there will be much more false signals, since the indicator becomes very sensitive when the smoothing percentage decreases.\n\nСглаживание для уменьшения ложных сигналов и выделения зоны флета. Если выставить процент равным нулю, то зоны флета выделяться не будут, но будет гораздо больше ложных сигналов, так как индикатор становится очень чувствительным при снижении процента сглаживания15float · min 0 · step 0.5bull bear Trading zones Volume difference
Show background zonesShow the color background of the current trading zone.\n\nПоказывать цветовой фон текущей торговой зоны.trueboolTrading zones
Show each setup in zoneShow every signals into trading zone.\n\nПоказывать каждый сигнал внутри торговой зоны.falseboolline 28

What it calculates

  • VWMAbull_vol, Search_range (11)avg_bull_vol · line 13
  • VWMAbear_vol, Search_range (11)avg_bear_vol · line 14
  • SMAavg_bull_vol / volume - 1 - (avg_bear_vol / volume - 1), Search_range (11)diff_vol · line 15

Signal flow

How price data and settings reach the orders. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.

maSearch_rangesetting · 11volumevolumeprice datalowlowprice datahighhighprice dataclosecloseprice dataopenopenprice datadeltaSmoothing_for_flat,%setting · 15directionDirectionsetting · ANYavg_bull_volVWMA→ avg_bull_volavg_bear_volVWMA→ avg_bear_voldiff_volSMA→ diff_volbull_vol, bear_volbull_vol · bear_vol2 valuesvol_flatvol_flatvalueupupvaluedndnvaluebull, bearbull · bear2 conditionsclose:ShortClose Shortstrategy.closeclose:LongClose Longstrategy.closeentry:LongOpen Longstrategy.entryentry:ShortOpen Shortstrategy.entryplotshape:32plotshapeplotshapeplotshape:33plotshapeplotshapebgcolor:34Trading zonesbgcolorplot:35Volume differenceplotalert:41alertalertalert:43alertalert

Order rules

OrderFires whenBy defaultLine
Close Shortbull and up == 1On36
Close Longbear and dn == 1On37
Open Long longdirection != 'SHORT' and bull and up == 1On38
Open Short shortdirection != 'LONG' and bear and dn == 1On39

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Alerts

AlertCallMessageLine
(no title)alertBullish movement! LONG trading zone41
(no title)alertBearish movement! SHORT trading zone43

Does it repaint?

No

No repainting patterns in the source, and the live replay matched history.

12/12trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
  • ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.

The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.

Other markets

The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D+92.0%+102.5%4531%1.6124.6%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−5.1%+5.5%5433%0.9321.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+68.7%+9.8%4933%1.2542.6%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+6.5%+8.4%5632%1.0723.8%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+20.9%+16.7%4544%1.0766.4%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−12.9%+21.5%5632%0.8837.7%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+140.1%+148.3%4945%2.1218.2%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−21.8%+17.1%4633%0.6636.8%8 May 2026 – 21 Oct 2026

Backtests are simulations on historical data and are not investment advice.

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market1118%−$2,882.13
Sideways market2438%$11,134.90
Falling market1030%$954.34

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

37.2%

The 95th percentile of the worst drawdown when the same 45 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 17.5% to 37.2%; the tick is what actually happened, 20.3%. Order luck alone moves it this much.

0%43%
All 45 trades
SideEntryExitBarsP&L
long6 Feb 2024 42,708.7016 Mar 2024 69,499.8039$6,262.48
short16 Mar 2024 69,499.8031 Mar 2024 69,582.2015−$19.85
long31 Mar 2024 69,582.206 Apr 2024 67,820.606−$261.06
short6 Apr 2024 67,820.6021 May 2024 71,446.6045−$542.86
long21 May 2024 71,446.601 Jun 2024 67,540.0011−$554.57
short1 Jun 2024 67,540.006 Jun 2024 71,108.005−$536.49
long6 Jun 2024 71,108.0016 Jun 2024 66,228.3010−$693.97
short16 Jun 2024 66,228.3017 Jul 2024 65,044.0031$170.88
long17 Jul 2024 65,044.001 Aug 2024 64,628.0015−$71.93
short1 Aug 2024 64,628.0017 Aug 2024 58,874.6016$882.59
long17 Aug 2024 58,874.604 Sep 2024 57,487.7018−$243.47
short4 Sep 2024 57,487.7018 Sep 2024 60,314.0014−$499.82
long18 Sep 2024 60,314.002 Oct 2024 60,804.9014$73.36
short2 Oct 2024 60,804.9015 Oct 2024 66,084.0013−$876.53
long15 Oct 2024 66,084.004 Dec 2024 95,849.7050$4,494.42
short4 Dec 2024 95,849.7021 Jan 2025 102,260.0048−$677.05
long21 Jan 2025 102,260.0015 Feb 2025 97,500.5025−$473.25
short15 Feb 2025 97,500.5022 Mar 2025 84,088.8035$1,368.10
long22 Mar 2025 84,088.8031 Mar 2025 82,390.009−$209.94
short31 Mar 2025 82,390.0010 Apr 2025 82,615.2010−$35.35
long10 Apr 2025 82,615.2020 May 2025 105,574.0040$2,769.86
short20 May 2025 105,574.0023 May 2025 111,696.003−$588.16
long23 May 2025 111,696.003 Jun 2025 105,858.0011−$530.48
short3 Jun 2025 105,858.004 Jul 2025 109,585.0031−$360.19
long4 Jul 2025 109,585.0026 Jul 2025 117,614.0022$724.43
short26 Jul 2025 117,614.0014 Aug 2025 123,306.0019−$492.16
long14 Aug 2025 123,306.0025 Aug 2025 113,494.0011−$803.49
short25 Aug 2025 113,494.0012 Sep 2025 115,483.0018−$183.33
long12 Sep 2025 115,483.0023 Sep 2025 112,651.0011−$253.11
short23 Sep 2025 112,651.004 Oct 2025 122,232.0011−$858.86
long4 Oct 2025 122,232.0011 Oct 2025 112,774.007−$781.44
short11 Oct 2025 112,774.0013 Dec 2025 90,268.4063$1,988.47
long13 Dec 2025 90,268.4026 Jan 2026 86,670.4044−$406.44
short26 Jan 2026 86,670.4017 Feb 2026 68,892.4022$2,044.03
long17 Feb 2026 68,892.4018 Feb 2026 67,503.501−$209.53
short18 Feb 2026 67,503.5011 Mar 2026 69,948.6021−$370.37
long11 Mar 2026 69,948.6028 Mar 2026 66,407.3017−$514.08
short28 Mar 2026 66,407.3014 Apr 2026 74,418.0017−$1,214.78
long14 Apr 2026 74,418.0018 May 2026 77,457.7034$400.30
short18 May 2026 77,457.707 Jul 2026 64,042.9050$1,724.57
long7 Jul 2026 64,042.902 Aug 2026 62,823.7026−$198.31
short2 Aug 2026 62,823.7020 Aug 2026 69,334.8018−$1,044.83
long20 Aug 2026 69,334.8011 Sep 2026 76,568.7022$1,034.92
short11 Sep 2026 76,568.7020 Sep 2026 81,250.009−$619.63
long20 Sep 2026 81,250.003 Oct 2026 84,518.0013$394.06

Similar scripts

Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.

ScriptSharesTypeNetTradesMax drawdown
Volume fight strategy this page—v5 strategy+92.0%4524.6%
Volume Weighted Moving Average by Zeal Terminalvwma smav5 indicatorindicator
Wave Trend w- VWMA overlay by jadamcraigvwma smav4 strategyNo trades on this market
VWMA-SMA 3Commas Bot by CrackingCryptocurrencysma vwmav5 strategy−1,774,150,000.0%15750,545.9%
Smoothed Heikin Ashi Trend on Chart - TraderHalai BACKTEST by TraderHalaisma vwmav5 strategy+1.3%1135.6%

Upgrade and export

Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.

  • 4 strategy calls use the when = argument (line 36, 37, 38, 39). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • No v6-only features. v6 is not needed to run this script.

Clean v5

VerifiedDownload the v5 script

Same 45 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 36: when = bull and up == 1 → if block
  • Line 37: when = bear and dn == 1 → if block
  • Line 38: when = direction != 'SHORT' and bull and up == 1 → if block
  • Line 39: when = direction != 'LONG' and bear and dn == 1 → if block
⋯plot(diff_vol, 'Volume difference', style=plot.style_area, color=avg_bull_vol > avg_bear_vol and vol_flat / avg_bull_vol < 1 - delta / 100 ? color.new(color.green, 0) : avg_bull_vol < avg_bear_vol and vol_flat / avg_bear_vol < 1 - delta / 100 ? color.new(color.red, 0) : color.new(color.gray, 50))-strategy.close('Short', comment='close', when=bull and up == 1)+if bull and up == 1+    strategy.close('Short', comment='close')-strategy.close('Long', comment='close', when=bear and dn == 1)+if bear and dn == 1+    strategy.close('Long', comment='close')-strategy.entry('Long', strategy.long, when=direction != 'SHORT' and bull and up == 1)+if direction != 'SHORT' and bull and up == 1+    strategy.entry('Long', strategy.long)-strategy.entry('Short', strategy.short, when=direction != 'LONG' and bear and dn == 1)+if direction != 'LONG' and bear and dn == 1+    strategy.entry('Short', strategy.short)if bull and up==1⋯

Does it run in Pine Script v6?

No

The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 45 before, 1 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © Shuttle_Club-//@version=5+//@version=6strategy('Volume fight strategy', default_qty_type=strategy.cash, default_qty_value=10000, currency='USD', commission_value=0.04, calc_on_order_fills=false, calc_on_every_tick=false, initial_capital=10000)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 42 msYes 1,000 bars in 49 msNot measured
PineTSNot testedNot testedNot measured

“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report.

Source

Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © Shuttle_Club//@version=5strategy('Volume fight strategy', default_qty_type=strategy.cash, default_qty_value=10000, currency='USD', commission_value=0.04, calc_on_order_fills=false, calc_on_every_tick=false, initial_capital=10000)direction = input.string('ANY', 'Direction', options=['LONG', 'SHORT', 'ANY'], tooltip='Select the direction of trade.\n\nВыберите направление торговли.')ma = input.int(11, 'Search_range', minval=1, tooltip='The range of estimation of the predominance of bullish or bearish volume (quantity bars). The smaller the TF, the higher the range value should be used to filter out false signals.\n\nДиапазон оценки преобладания бычьего или медвежьего объема (количество баров). Чем меньше ТФ, тем выше следует использовать значение диапазона, чтобы отфильтровать ложные сигналы.')delta = input.float(15, 'Smoothing_for_flat,%', step=0.5, minval=0, tooltip='Smoothing to reduce false signals and highlight the flat zone. If you set the percentage to zero, the flat zones will not be highlighted, but there will be much more false signals, since the indicator becomes very sensitive when the smoothing percentage decreases.\n\nСглаживание для уменьшения ложных сигналов и выделения зоны флета. Если выставить процент равным нулю, то зоны флета выделяться не будут, но будет гораздо больше ложных сигналов, так как индикатор становится очень чувствительным при снижении процента сглаживания')bgshow = input.bool(true, 'Show background zones', tooltip='Show the color background of the current trading zone.\n\nПоказывать цветовой фон текущей торговой зоны.')all_signal_show = input.bool(false, 'Show each setup in zone', tooltip='Show every signals into trading zone.\n\nПоказывать каждый сигнал внутри торговой зоны.')/////   CALCULATIONbull_vol = open < close ? volume : volume * (high - open) / (high - low)  //determine the share of bullish volumebear_vol = open > close ? volume : volume * (open - low) / (high - low)  //determine the share of bearish volumeavg_bull_vol = ta.vwma(bull_vol, ma)  //determine vwmaavg_bear_vol = ta.vwma(bear_vol, ma)diff_vol = ta.sma(avg_bull_vol / volume - 1 - (avg_bear_vol / volume - 1), ma)  //normalize and smooth the valuesvol_flat = math.abs(avg_bull_vol + avg_bear_vol) / 2  //determine average value for calculation flat-filter/////   SIGNALSup = int(na), up := nz(up[1])dn = int(na), dn := nz(dn[1])bull = avg_bull_vol > avg_bear_vol and vol_flat / avg_bull_vol < 1 - delta / 100  //determine up zonesbear = avg_bull_vol < avg_bear_vol and vol_flat / avg_bear_vol < 1 - delta / 100  //determine dn zonesif bull    up += 1, dn := 0    dnif bear    dn += 1, up := 0    upif not bull and not bear and all_signal_show    up := 0, dn := 0    dn/////   PLOTTINGplotshape(bull and up == 1, 'UP', location=location.bottom, style=shape.triangleup, color=color.new(color.green, 0), size=size.tiny)plotshape(bear and dn == 1, 'DN', location=location.top, style=shape.triangledown, color=color.new(color.red, 0), size=size.tiny)bgcolor(title='Trading zones', color=bgshow and avg_bull_vol > avg_bear_vol and vol_flat / avg_bull_vol < 1 - delta / 100 ? color.new(color.green, 85) : bgshow and avg_bull_vol < avg_bear_vol and vol_flat / avg_bear_vol < 1 - delta / 100 ? color.new(color.red, 85) : na)plot(diff_vol, 'Volume difference', style=plot.style_area, color=avg_bull_vol > avg_bear_vol and vol_flat / avg_bull_vol < 1 - delta / 100 ? color.new(color.green, 0) : avg_bull_vol < avg_bear_vol and vol_flat / avg_bear_vol < 1 - delta / 100 ? color.new(color.red, 0) : color.new(color.gray, 50))strategy.close('Short', comment='close', when=bull and up == 1)strategy.close('Long', comment='close', when=bear and dn == 1)strategy.entry('Long', strategy.long, when=direction != 'SHORT' and bull and up == 1)strategy.entry('Short', strategy.short, when=direction != 'LONG' and bear and dn == 1)if bull and up==1    alert('Bullish movement! LONG trading zone', alert.freq_once_per_bar_close)if bear and dn==1    alert('Bearish movement! SHORT trading zone', alert.freq_once_per_bar_close)