ZenAndTheArtOfTrading

Volume+ (RVOL By Time of Day)

This script is an enhanced volume indicator.

It calculates relative volume (RVOL) based on the average volume at that time of day (rather than using a moving average).

For example, using this indicator you can see today’s volume during the first 5-minute candle of the market open compared to the previous day’s volume at the market open. Or you can see today’s volume at the market close during the last 15-minute candle compared to the average of the past 20 days of volume at the market close.

Due to the different quantity of candlesticks in a session between Stocks and Forex/Crypto, I separated those markets into separate settings, making this an all-in-one volume indicator that works on all markets.

Settings:

Stocks
If you set the lookback period to 1 on the 5-minute chart and look at the 9:30am candle for a stock, then the current volume bar will show you what today’s volume is compared to yesterday’s 9:30am 5-minute candle.

If you set the lookback period to 15, then the current volume bar will show you what today’s volume is compared to the average of the last 15 days of 9:30am 5-minute candles.

Max Lookback: 64 Sessions

Stocks
This setting is for traders who want to use this indicator on a timeframe lower than the 5-minute chart.

Due to limitations in how many historical bars PineScript can reference, referencing 1-minute and 3-minute bars requires a lot more historical data so I separated the two to allow the 5-minute+ timeframes to have a longer lookback period.

Max Lookback: 12 Sessions

Forex/Crypto
When you set the script to Forex/Crypto, it does the same thing for stocks but calculates based on a 24-hour period.

So if you set the lookback period to 1 on the 1-hour chart and look at the 11:00am candle for a currency pair, then the current volume bar will show you what today’s volume is compared to yesterday’s 11:00am 1-hour candle.

If you set the lookback period to 10, then the current volume bar will show you what today’s volume is compared to the average of the last 10 days of 11:00am 1-hour candles.

Max Lookback: 17 Sessions

What Doesn’t It Work On?

Because I had to manually calculate how many volume candles to look back per timeframe to get the previous session’s candle, I had to hard-code the math in this script.

That means that this indicator will only work on 1m, 3m , 5m, 15m, 30m, 45m, 1h, 2h, 3h, 4h, Daily and Weekly timeframes. If you try to use it on any other timeframe it will revert to a regular volume indicator.

Why Is It Useful?

Similar to volume profile by price, this gives you a volume profile by time in a way that the default volume indicator does not.

For example, you can use this to determine when a stock has a particularly strong opening drive, or when a currency pair has a weak fake-out leading up to the London open, or for general confirmation on trading signals with time-specific volume information to work with.

Colors

The purple line and the faint gray bar is the RVOL value.
The blue number is the percentage of the current volume bar relative to RVOL.

There are four different bar color settings:

Heatmap – Changes color to be brighter based on higher RVOL
Price – Changes color based on price action (like the default TradingView volume indicator)
Traffic – Changes color based on RVOL percentages (for fast visual cues)
Trigger – Changes color only when the specified alert conditions are met

Heatmap:

Traffic:

Trigger:

Price:

Heatmap:
Turns very bright green at 2.0 RVOL
Turns light green at 1.0 RVOL
Turns normal green at 0.75 RVOL
Turns medium green at 0.5 RVOL
Turns very dark green at 0.25 RVOL
Is gray otherwise.

Price:
Turns red if the price action candle closed bearish .
Turns green if the price action candle closed bullish .

Traffic:
Turns red if RVOL is between 1.0 and 1.5.
Turns orange if RVOL is between 1.5 and 2.0.
Turns dark green if RVOL is between 2.0 and 3.0.
Turns bright green if RVOL is above 3.0.
Is gray otherwise.

Trigger:
Turns teal if any of the given alert conditions in the user settings are met.

Alerts

Alerts are optional. You have to set them like any other indicator, by creating a new alert and selecting this indicator.
If you leave the "Alert At RVOL %" setting at 0, then alerts will only be triggered if the current candle exceeds the 1.0 (100%) RVOL level.

If you change the "Alert At RVOL %" setting then alerts will be triggered if the RVOL percentage (blue number) exceeds your given value. The blue number is a percentage of the average, so if it’s at 0.5, then it’s 50% of the average.

Notes
- This indicator only works with regular time bars. It will not work with range, tick, renko etc.
- This script has lookback limitations due to restrictions on how many historical bars PineScript can reference. The lookback limit varies based on the market type you choose. The more bars required for calculation the lower the lookback limit.
- If you use it on the Daily timeframe the lookback period will count as 1 week. If you use it on the Weekly timeframe the lookback period will count as 1 month. So a Lookback of 3 on the Daily would be 3 weeks of averages, a Lookback of 5 on the Weekly would be 5 months of averages (for that Day of Week or Week number).
- Big thanks to @tb12345 for the idea and for helping to field-testing the indicator!

- Go to http://www.zenandtheartoftrading.com/ind... for the source code – it’s free!
Notas de Lançamento: Added support for Futures markets.
Notas de Lançamento: Fixed Crypto Daily volume.
Remover dos Scripts Favoritos Adicionar para Scripts Favoritos
Follow @TradeWisdom on Twitter for Daily inspiration from the best trading wizards, psychologists and philosophers.

Go to http://www.zenandtheartoftrading.com for articles on forex trading, trading psychology, trading resources, PineScript lessons and more!
Hello, thanks for the awesome contribution. I you would allow it, I'd like to add some custom time frames to you indicator. I went to your website and liked and shared you on my social media, however information does not show up. Am I doing something incorrect?
Resposta
@Pin-Head, Of course! Sorry about that, not sure why that's not working. I'll PM you the source code instead :)
Resposta
Hey brother really appreciate your work.
Any idea how to get this to work with futures data? (ES, NQ, RTY etc?)
Resposta
@Maustula, Hey man! I appreciate your appreciation :) I just added Futures support. You can now select "Futures" from the Markets setting. Please PM me if you find any issues but it appears to be working from what I have tested.



Happy trading :)
Resposta
Maustula ZenAndTheArtOfTrading
@ZenAndTheArtOfTrading, brrroooooski that's siiiiiiick thank y0u!!! https://tenor.com/yTK4.gif
Resposta
ESSCRS ZenAndTheArtOfTrading
@ZenAndTheArtOfTrading, great job man thank you, have you thought of trying this same type of script but with range for each bar. Thanks again
Resposta
@ESSCRS, Thanks man!

As in an ATR-like script by time of day? If that's what you mean then that's great. When I woke up this morning the very first thought I had was 'I should try converting that RVOL script to an ATR version' lol. I've already started working on it

The problem is that the official ATR formula uses the previous candle's data to calculate the range value, and doing that with a long lookback period in a For-Loop is far too hard to do in pinescript. I'll think about it for a while but I think it's impossible.

In the meantime I can make a simple one that only averages the range of each candle's high and low, that's probably the best we can get but it should be close enough for most markets that don't gap too frequently.

I'll play around with it and let you know what I come up with :)
Resposta
Wow, this is awesome and well thought out. I was personally just looking for the RVOL (you mentioned its the grey histogram but I believe its the Percentage. ie. currentVolume/avgVolume=RVOL) value itself for any given stock and Tradingview doesn't offer it aside from in screeners. I dug through your source code to check and (I'm not expert in programming) but it seems as though the 'stocks' option in the drop window doesn't account for premarket/aftermarket trading. Its probably alot of work but I would appreciate if you could add that option. I could be completely wrong on this so forgive me if you have an easy solution. I did also try to to run the forex/crypto option considering I wanted a 24hs worth of data per period, but it gave me odd results. Id probably be willing to venmo you if you could help a guy out:) Thankyou and great work despite my struggles.
Resposta
@nolinspuzak98, Hey man, thanks for the kind words! Awesome idea! I mostly trade Forex so I completely forgot about premarket trading for stocks. You're correct that it doesn't account for that.

I'm busy today but when I get time later on I'll definitely look into it. I've never used premarket data on TradingView so I can't promise anything as I don't know what I'm in for, but I'll give it my best shot!

I'll let you know what I find. Peace :)
Resposta
nolinspuzak98 ZenAndTheArtOfTrading
@ZenAndTheArtOfTrading, Sounds good! Thanks for the reply!
Resposta
Início Rastreador de Fundamentos Rastreador Forex Rastreador de Sinais Criptomoedas Calendário econômico Como Funciona Recursos gráficos Planos Regras da Casa Moderadores Soluções para sites e corretoras Widgets Soluções em Gráficos Obter Ajuda Solicitação de recurso Notícias do & blog FAQ Wiki Twitter
Perfil Configurações de perfil Conta e cobrança Obter Ajuda Ideias Publicadas Seguidores Seguindo Mensagens Privadas Conversa Deslogar