//@version=5
indicator("24-hour Volume", "24H Vol", format=format.volume)
priceTooltip = "If the symbol's volume is expressed in base units, it is multiplied by this value to convert it into a price."
price = input.source(close, "Price Source", tooltip = priceTooltip)
currencyInput = input.string(title = "Target Currency", defval="Default", options=["Default", "USD", "EUR", "CAD", "JPY", "GBP", "HKD", "CNY", "NZD", "RUB"])
currency = currencyInput == "Default" ? "" : currencyInput
msIn24h = 24 * 60 * 60 * 1000
maxBufferSize = switch
timeframe.isminutes or timeframe.isseconds => 24 * 60
timeframe.isdaily => 24 * 60 / 5
=> 24
cumVolTF = switch
timeframe.isminutes or timeframe.isseconds => "1"
timeframe.isdaily => "5"
=> "60"
cum24hVol(s) =>
src = s
if bar_index == 0
// Creating a buffer of 'maxBufferSize+1' for 'src' and 'time' to avoid the 'max_bars_back' error
src := src[maxBufferSize+1] * time[maxBufferSize+1] * 0
var cumSum = 0.
var int firstBarTimeIndex = na
if na(firstBarTimeIndex) // 24H have not elapsed yet
sum = 0.
for i = 0 to maxBufferSize
if (time - time[i]) >= msIn24h
firstBarTimeIndex := bar_index - i + 1
break
sum += src[i]
cumSum := sum
else
cumSum += nz(src)
for i = firstBarTimeIndex to bar_index
if (time - time[bar_index - i]) < msIn24h
firstBarTimeIndex := i
break
cumSum -= nz(src[bar_index - i])
cumSum
noVolumeError = "The data vendor doesn't provide volume data for this symbol."
if syminfo.volumetype == "tick" and syminfo.type == "crypto"
runtime.error(noVolumeError)
var cumVol = 0.
cumVol += nz(volume)
if barstate.islast and cumVol == 0
runtime.error(noVolumeError)
expr = syminfo.volumetype == "quote" ? volume : price * volume
vol24h = request.security(syminfo.tickerid, cumVolTF, cum24hVol(expr), currency = currency)
plot(vol24h, title = "24H Volume", style = plot.style_columns)
Overview
On each bar it builds a running sum of volume over the last 24 hours, using a one-minute, five-minute, or hourly series depending on the chart timeframe. When the symbol's volume is in base units it multiplies volume by the chosen price source; quote volume is used as is. A target currency setting can convert the result, and the script stops with an error when the symbol has no usable volume.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Price Source
source
close
price
Target Currency
string
Default
currencyInput
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