Strategy · Pine Script v5 · On the chart

VWAP Bounce - Eterna

by EternaHybridExchange

This strategy overlays volume-weighted average price deviation bands and an exponential moving average trend filter directly on the price chart.

View on GitHub

GitHub stars9on the repository
Pine versionv5runs as is
Lines of code69
Settings5inputs
LicenceMIT
Last update7 months ago12 Mar 2026

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

69 lines of Pine Script v5 from strategies/trend-following/vwap-bounce/strategy.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

strategy.pine
//@version=5
strategy("VWAP Bounce - Eterna", 
         overlay=true, 
         initial_capital=10000,
         default_qty_type=strategy.percent_of_equity, 
         default_qty_value=10,
         commission_type=strategy.commission.percent,
         commission_value=0.075)

// ==================== Parameters ====================
vwapDeviation = input.float(0.5, "VWAP Deviation %", minval=0.1, step=0.1)
trendEMA = input.int(50, "Trend EMA", minval=1)
leverage = input.int(5, "Leverage", minval=1, maxval=100)
positionSize = input.float(0.01, "Position Size", minval=0.001, step=0.001)

// Eterna Webhook Settings
webhookMessage = input.string('{"action":"{{strategy.order.action}}", "symbol":"{{ticker}}", "size":' + str.tostring(positionSize) + ', "leverage":' + str.tostring(leverage) + '}', 
                               "Webhook JSON", 
                               group="Webhook")

// ==================== Indicators ====================
vwapValue = ta.vwap(close)
ema50 = ta.ema(close, trendEMA)

// VWAP bands
vwapUpper = vwapValue * (1 + vwapDeviation / 100)
vwapLower = vwapValue * (1 - vwapDeviation / 100)

// ==================== Entry Conditions ====================
// Uptrend: Price above EMA and bounces off VWAP support
uptrend = close > ema50
longCondition = uptrend and ta.crossover(close, vwapLower) and low <= vwapLower

// Downtrend: Price below EMA and rejects from VWAP resistance
downtrend = close < ema50
shortCondition = downtrend and ta.crossunder(close, vwapUpper) and high >= vwapUpper

// Exit conditions
exitLong = ta.crossunder(close, vwapValue)
exitShort = ta.crossover(close, vwapValue)

// ==================== Strategy Execution ====================
if longCondition
    strategy.entry("Long", strategy.long, alert_message=str.replace(webhookMessage, "{{strategy.order.action}}", "buy"))

if shortCondition
    strategy.entry("Short", strategy.short, alert_message=str.replace(webhookMessage, "{{strategy.order.action}}", "sell"))

if exitLong
    strategy.close("Long", alert_message='{"action":"close", "symbol":"{{ticker}}"}')

if exitShort
    strategy.close("Short", alert_message='{"action":"close", "symbol":"{{ticker}}"}')

// ==================== Plotting ====================
plot(vwapValue, "VWAP", color=color.blue, linewidth=2)
plot(vwapUpper, "VWAP Upper", color=color.new(color.blue, 70), style=plot.style_circles)
plot(vwapLower, "VWAP Lower", color=color.new(color.blue, 70), style=plot.style_circles)
plot(ema50, "Trend EMA", color=color.orange, linewidth=1)

plotshape(longCondition, "Long", shape.triangleup, location.belowbar, color.green, size=size.small)
plotshape(shortCondition, "Short", shape.triangledown, location.abovebar, color.red, size=size.small)

// Fill between bands
upperBand = plot(vwapUpper, display=display.none)
lowerBand = plot(vwapLower, display=display.none)
fill(upperBand, lowerBand, color=color.new(color.blue, 95))

bgcolor(uptrend ? color.new(color.green, 97) : color.new(color.red, 97))

Overview

VWAP Bounce - Eterna enters long positions during an uptrend when price recovers above the lower band, and enters short positions in a downtrend when price falls below the upper band. Open trades exit when price crosses the central volume-weighted average price line. Key settings adjust the percentage band deviation and the trend filter period. The strategy operates without a defined stop loss.

Details

Published by

EternaHybridExchange on GitHub

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Mean reversion, Trend, Moving averages

Markets

Crypto

Timeframes

M15-H1

Risk Notes

  • The strategy enters trades without a stop loss

Topics

algorithmic-tradingautomated-tradingbacktestingbybitcrypto-tradingeternamcppine-scripttrading-strategiestradingview

Settings

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

SettingTypeDefaultVariable
VWAP Deviation %float0.5vwapDeviation
Trend EMAint50trendEMA
Leverageint5leverage
Position Sizefloat0.01positionSize
Webhook JSONstring'{"action":"{{strategy.order.action}}", "symbol":"{{ticker}}webhookMessage
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

This mean-reversion strategy plots Bollinger Bands and a long-term moving average directly on the price chart. It enters trades when price candles penetrate the outer Bollinger Bands beyond a user-defined body percentage, anticipating a price reversal. Entries

Strategy v5 Mean reversionVolatility & bands
Updated 2 months ago · None stated GitHub repository of Bollinger Bands Winner PRO [Alorse]

8 Day Run

by hasnocool
106 stars

Inspired by Linda Raschke's strategy for T-note futures, this script identifies extended trends where price remains on one side of a 5-period SMA for more than eight consecutive bars. It enters long on the first pullback below the SMA following an eight-bar bu

Strategy v4 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of 8 Day Run

Bollinger Bands Strategy

by cklose2000
105 stars

This strategy generates buy and sell signals based on Bollinger Band crossovers combined with a simple moving average trend filter. It enters a long position when price crosses above the lower band while trading above the SMA filter line, and enters a short po

Strategy v5 Volatility & bandsMoving averages
Updated 1 year ago · None stated GitHub repository of Bollinger Bands Strategy
53 stars

This strategy identifies long entry opportunities based on short-term price pullbacks below a major trend filter. It enters long when three consecutive lower closes occur below the 200-period simple moving average, followed by the current bar closing back abov

Strategy v6 TrendMoving averages
Updated 2 months ago · MPL-2.0 GitHub repository of Ivan Scherman Pattern - TP/SL
13 stars

This strategy evaluates market trend direction using a Noro TrendRibbon and creates a price corridor based on recent moving-average extremes, plotting directly on the price chart. It executes long entries when price dips below the corridor during an upward tre

Strategy v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ruckard Noro TrendRibbon G004
7 stars

This long-only strategy identifies pullback opportunities within a broader trend. It enters a long position when the closing price trades above a long-term exponential moving average while falling below a short-term exponential moving average. Once in a trade,

Strategy v5 TrendMoving averages
Updated 1 year ago · MPL-2.0 GitHub repository of Pullback Strategy for Stocks

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