Strategy · Pine Script v5 · On the chart

Version Alpha: Composite Momo + Volume + Price Strategy

by jawauntb

This strategy evaluates market conditions on the price chart by combining composite RSI STARC bands, an EMA and SMA crossover, VWAP standard deviation bands, and security-derived volume metrics.

View on GitHub

Repaints

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code78
Settings7inputs
LicenceGPL-3.0
Last update2 years ago22 May 2024

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

78 lines of Pine Script v5 from Version Alpha: Composite Momo + Volume + Price Strategy.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

Version Alpha: Composite Momo + Volume + Price Strategy.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jawauntb

//@version=5
strategy("Version Alpha: Composite Momo + Volume + Price Strategy", overlay=true)

// Inputs
rsiPeriod = input(14, "RSI Period")
emaPeriod = input(13, "EMA Period")
maPeriod = input(30, "MA Period")
vwapPeriod = input(14, "VWAP Period")
stdDevMult = input(1.0, "Standard Deviation Multiplier")
tprInput = input(8, "VRVP Ticks Per Row")

// CVD
[cvdUp, cvdDown] = request.security(syminfo.tickerid, timeframe.period, expression=[high, low], lookahead=barmerge.lookahead_on)
cvd = cvdUp - cvdDown

// Composite RSI and Starc Bands
rsiSource = close
rsiDelta = ta.rsi(rsiSource, rsiPeriod) - ta.rsi(rsiSource, rsiPeriod)[9]
rsiSma = ta.sma(ta.rsi(rsiSource, 3), 3)
compRsi = rsiDelta + rsiSma
starcBandMultiplier = input(2.0, "Starc Band Multiplier")
starcBasis = ta.sma(compRsi, rsiPeriod)
starcDev = starcBandMultiplier * ta.stdev(compRsi, rsiPeriod)
starcUpper = starcBasis + starcDev
starcLower = starcBasis - starcDev
starcRsiUp = ta.crossover(compRsi, starcUpper)
starcRsiDown = ta.crossunder(compRsi, starcLower)

// EMA/MA Cross
ema = ta.ema(close, emaPeriod)
ma = ta.sma(close, maPeriod)
emaMaCross = ta.crossover(ema, ma)

// VWAP
vwap = ta.vwap(hlc3, vwapPeriod)
vwapUpper = vwap + stdDevMult * ta.stdev(vwap, vwapPeriod)
vwapLower = vwap - stdDevMult * ta.stdev(vwap, vwapPeriod)

// VRVP
[poc, _, _] = request.security(syminfo.tickerid, timeframe.period, expression=[close, high, low], lookahead=barmerge.lookahead_on)
[totalVolume, _, _] = request.security(syminfo.tickerid, timeframe.period, expression=[volume, high, low], lookahead=barmerge.lookahead_on)
tpr = tprInput/syminfo.mintick
vrvpUpperBound = poc + tpr * 0.8
vrvpLowerBound = poc - tpr * 0.8

// Footprint
[fpAbovePriceBuy, fpAbovePriceSell] = request.security(syminfo.tickerid, timeframe.period, expression=[high, low], lookahead=barmerge.lookahead_on)
[fpBelowPriceBuy, fpBelowPriceSell] = request.security(syminfo.tickerid, timeframe.period, expression=[high, low], lookahead=barmerge.lookahead_on)
fpAbovePrice = fpAbovePriceBuy - fpAbovePriceSell
fpBelowPrice = fpBelowPriceBuy - fpBelowPriceSell

// Signal
longSignal = (cvd > 0) and starcRsiUp and emaMaCross and (close > vwap) and (close < vrvpUpperBound) and (fpAbovePrice > 0)
shortSignal = (cvd < 0) and starcRsiDown and not emaMaCross and (close < vwap) and (close > vrvpLowerBound) and (fpBelowPrice < 0)

// Entry/Exit
longCondition = longSignal and strategy.position_size == 0
if (longCondition)
    strategy.entry("Long", strategy.long)

shortCondition = shortSignal and strategy.position_size == 0
if (shortCondition)
    strategy.entry("Short", strategy.short)

if (strategy.position_size > 0)
    if (close < vwapLower) or (fpAbovePrice < 0)
        strategy.close("Long", comment="Exit Long - Below VWAP Lower Band or Footprint Above Price is Bearish")
    else if (close > vrvpUpperBound)
        strategy.close("Long", comment="Exit Long - Above VRVP Upper Bound")

if (strategy.position_size < 0)
    if (close > vwapUpper) or (fpBelowPrice > 0)
        strategy.close("Short", comment="Exit Short - Above VWAP Upper Band or Footprint Below Price is Bullish")
    else if (close < vrvpLowerBound)
        strategy.close("Short", comment="Exit Short - Below VRVP Lower Bound")

Overview

Version Alpha: Composite Momo + Volume + Price Strategy enters long positions when cumulative delta, momentum breakouts, moving averages, and volume levels align bullishly, and enters short on mirrored bearish conditions. Exits trigger when price breaches the outer VWAP bands, crosses volume bounds, or displays opposite order flow pressure. Notable limitations include lookahead bias from security calls with enabled lookahead, and the absence of a hard stop loss.

Details

Published by

jawauntb on GitHub

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Oscillators & momentum, Moving averages, Volume, Volatility & bands

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time
  • 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
RSI Periodint14rsiPeriod
EMA Periodint13emaPeriod
MA Periodint30maPeriod
VWAP Periodint14vwapPeriod
Standard Deviation Multiplierfloat1.0stdDevMult
VRVP Ticks Per Rowint8tprInput
Starc Band Multiplierfloat2.0starcBandMultiplier
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

BB+RSI+OBV

by hasnocool
106 stars

This strategy combines Bollinger Bands, the Relative Strength Index (RSI), and On-Balance Volume (OBV) to generate trade signals directly on the price chart. Long entries trigger when price is above the middle SMA band, RSI is over 50, and OBV is rising. Short

Strategy v4 Volatility & bandsOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of BB+RSI+OBV

CombinedBinHAndClucV8

by viktors1982
36 stars

This strategy trades on the price chart using multiple indicators. It enters long positions when price dips meet conditions on Bollinger Bands 40 and 20, RSI, MFI, volume and other thresholds. It exits at custom ROI profit levels based on RSI or after timeout

Strategy v4 Oscillators & momentumMoving averages Repaints
Updated 2 years ago · None stated GitHub repository of CombinedBinHAndClucV8
4 stars

The Simpleton STEPFUN Strategy combines signals from multiple technical indicators including RSI-2, MACD crossover, Bollinger Band squeeze, volume spikes, triple EMA, and Ichimoku cloud. It generates buy signals when the weighted ensemble meets or exceeds the

Strategy v5 Oscillators & momentumVolatility & bands
1 stars

TnSovereignSignalForgeV20 is a price-chart strategy that combines seven directional votes from RSI, EMA, MACD, volume, VWAP, Bollinger Bands, and a volume oscillator. A long condition requires the vote total to meet a minimum agreement setting. A thermodynamic

Strategy v6 Oscillators & momentumMoving averages
Updated 2 months ago · None stated GitHub repository of TnSovereignSignalForgeV20
330 stars

This strategy plots MACD line, signal line, Bollinger Bands, and RSI on the price chart. It signals long entries on MACD crossover above signal with RSI below 50 and price below BB basis, plus optional DMI filter. Short entries are available but disabled by de

Strategy v5 Oscillators & momentumVolatility & bands
Updated 2 months ago · None stated GitHub repository of MACD + BB + RSI [Alorse]
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

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