1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
70 lines of Pine Script v5 from price-volume-tema.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.
price-volume-tema.pine
//@version=5
indicator(title="VGF Price-Volume TEMA", shorttitle="PV-TEMA", overlay=true, timeframe="", timeframe_gaps=true)
// import TradingView/ta/5
length = input.int(21, minval=1)
upColor = input.color(color.new(color.blue, 0), "up color")
downColor = input.color(color.new(color.orange, 0), "down color")
messyColor = input.color(color.black, "messy color")
messy = input.int(1500, "messy range", tooltip = "values smaller than this is considered non-trending/messy")
bv = (close-open) * volume // body x volume
bvema1 = ta.ema(bv, length)
bvema2 = ta.ema(bvema1, length)
bvema3 = ta.ema(bvema2, length)
bvout = 3 * (bvema1 - bvema2) + bvema3
b = math.abs(bvout)
b2 = math.abs(bvout[1])
b3 = math.abs(bvout[2])
isMessy = b < messy and b2 < messy and b3 < messy
upCandle = close > open
countertrend_transparency = input.int(70, title="countertrend transparency")
// series color c = input.color(color.gray, title="pending candle")
color c = na
// Function to check if the current bar is inside the previous bar
isInsideBar(currentHigh, currentLow, previousHigh, previousLow) =>
currentHigh <= previousHigh and currentLow >= previousLow
// Get the high and low values of the last three bars
currentHigh = high
currentLow = low
previousHigh = high[1]
previousLow = low[1]
priorHigh = high[2]
priorLow = low[2]
// Check for the single inside bar pattern
singleInsideBarPattern = isInsideBar(currentHigh, currentLow, previousHigh, previousLow)
// Check for the double inside bar pattern
doubleInsideBarPattern = singleInsideBarPattern and isInsideBar(previousHigh, previousLow, priorHigh, priorLow)
// Function to check if the current bar is outside the previous bar
isOutsideBar(currentHigh, currentLow, previousHigh, previousLow) =>
currentHigh > previousHigh and currentLow < previousLow
// Check for the outside bar pattern
outsideBarPattern = isOutsideBar(currentHigh, currentLow, previousHigh, previousLow)
string my_session = input.session("0830-1500", title='New York Session')
timeinrange(res, sess) => not na(time(res, sess)) ? true : false
in_session = timeinrange(timeframe.period, my_session)
if (in_session and doubleInsideBarPattern)
c := color.gray
else if (in_session and outsideBarPattern)
c := upCandle ? color.green : color.red
else
c := isMessy ? color.black : (bvout > 0 ? color.new(upColor, upCandle ? 0 : countertrend_transparency) : color.new(downColor, not upCandle ? 0 : countertrend_transparency))
barcolor(c)
colorchanged = c != c[1]
alertcondition(barstate.isconfirmed and colorchanged, "Price Volume alert", "A change in price-volume trend has been detected.")
Overview
VGF Price-Volume TEMA categorizes market flow into trending bullish, trending bearish, or non-trending messy conditions based on a user-defined threshold. Within a specified trading session, it also detects double inside bar and outside bar candlestick patterns, coloring the bars gray, green, or red accordingly. It plots directly on the price chart and triggers alerts when the bar coloring changes.
Triple exponential moving average of candle body volume
Threshold-based messy market detection
Session-filtered inside bar and outside bar pattern detection
Countertrend transparency adjustment for candle coloring
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
length
int
21
length
up color
color
color.new(color.blue, 0)
upColor
down color
color
color.new(color.orange, 0)
downColor
messy color
color
color.black
messyColor
messy range
int
1500
messy
countertrend transparency
int
70
countertrend_transparency
New York Session
session
0830-1500
my_session
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.
The Midnight VWAP indicator calculates and overlays two distinct Volume Weighted Average Price (VWAP) lines on the price chart based on customizable session timeframes. It tracks an overnight or pre-market session alongside regular trading hours, resetting cal
Point-Clip Unified Indicator plots breakout and directional labels on the price chart. It scores volume spikes against a volume average, range or opening-range breaks, optional VWAP or session-anchored VWAP, fast and slow EMA trend, and a higher-timeframe EMA
This indicator plots price action tools directly on the main price chart. It shades candles according to Internal Bar Strength (IBS) and optional wick-length thresholds to differentiate trend bars from trading ranges. The script tracks session bar counts durin
TradeKit is an all-in-one technical analysis indicator that consolidates multiple chart overlays into a single script on the price chart. It plots up to four customizable moving averages (SMA, EMA, SMMA, WMA, or VWMA), Bollinger Bands, VWAP, and reference leve
This indicator recolors price candles from recent volume and range. It marks climax bars when current volume times range exceeds the prior ten-bar peak or volume is at least twice a ten-bar average, and rising bars at one and a half times that average. Bullish
Hercules Indicator 1.7 is a multi-filter trade signal generator designed to overlay entry conditions directly on the price chart. It evaluates engulfing candle patterns alongside multiple configurable filters, including trading session windows (Sydney, Tokyo,