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
38 lines of Pine Script v6 from volume_percent_ma/volume_percent_ma.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.
volume_percent_ma.pine
// Copyright 2025 Major Hayden
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//@version=6
indicator('Volume Percent of MA', shorttitle='Vol % MA', format=format.volume, overlay=false)
// User inputs
maLength = input.int(20, 'MA Length', minval=1)
maType = input.string('SMA', 'MA Type', options=['SMA', 'EMA'])
minPercent = input.int(100, 'Minimum % to Display', minval=100, step=10, tooltip='Bars below this percentage are hidden (100 = show all above MA)')
useIBDColoring = input.bool(true, 'Color based on previous close', tooltip='Color based on previous bar close instead of current bar open')
chartTheme = input.string('Dark', 'Chart Theme', options=['Light', 'Dark'], tooltip='Select your chart background theme for proper color visibility')
// MA Calculation
ma = maType == 'SMA' ? ta.sma(volume, maLength) : ta.ema(volume, maLength)
// Percentage Calculation (only when volume > MA and meets minimum threshold, otherwise na = hidden)
volumePercent = volume > ma and ma > 0 and (volume / ma) * 100 >= minPercent ? (volume / ma) * 100 : na
// Color Logic
priceUp = useIBDColoring ? close >= close[1] : close >= open
upColor = chartTheme == 'Light' ? color.black : color.gray
downColor = color.red
barColor = priceUp ? upColor : downColor
// Plot
plot(volumePercent, style=plot.style_columns, color=barColor, linewidth=1, title='Volume %')
Overview
Volume Percent of MA shows a column only when volume is above that average and at or above a minimum percentage; other bars stay hidden. Users set the average length and type, the display threshold, and whether color follows the previous close or the current open. Up and down colors adapt to a light or dark chart theme. It draws columns in a separate pane and does not generate trade signals.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
MA Length
int
20
maLength
MA Type
string
SMA
maType
Minimum % to Display
int
100
minPercent
Color based on previous close
bool
true
useIBDColoring
Chart Theme
string
Dark
chartTheme
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.
Calculates the standard Money Flow Index (MFI) oscillator alongside an exponential moving average signal line in a separate pane. The script visually highlights trend conditions through dynamic ribbon filling, optional difference histogram bars, and overbought
This indicator plots a Supertrend-based trend-following setup in a separate pane and skips conditions it treats as a sideways market. A volatility range is built from an ATR value, with RMA, SMA, EMA, or WMA smoothing, or from a fixed point distance. Optional
Range Volume Change compares volume inside a chosen session window with the same window on the previous day and plots that change as a percentage. It accumulates volume during the window and, when enabled, volume outside it, drawing growing columns in a separa
This indicator builds a footprint of estimated buy and sell volume across price rows and plots it in a separate pane. It fills rows from bar low to high, stores volume per row, and draws buy and sell volume boxes, volume-profile boxes, row labels, and cumulati
This indicator measures directional momentum by evaluating candlestick body proportions and volume over a user-defined lookback window. It computes the ratio of candle body to total range, weights the cumulative value by volume and absolute body size, and dete
This indicator builds an aggregate oscillator in a separate pane. It scales open, high, low, close, and volume into a 0 to 1 range, then averages scaled readings from MACD, a MACD histogram, RSI, stochastic, CCI, momentum, OBV, a directional index, volume-weig