PROTECTED SOURCE SCRIPT

Rolling Relative Volume

This script sums the volume for the selected period and compares it to the selected period before that. It works on a rolling basis, so it is suitable for 24/7 markets such as crypto. That is the main difference between this and the regular RVOL indicator. Of course lower timeframes can also be selected for comparing changes in volume, but you should be aware how the times when markets are closed affect the calculation. For example, if used on stocks, the indicator will use the data that is available, meaning that the amount of data needed to calculate daily cumulative volume can be stretched out over a few days. If the stock session is 8 hours long, that comes out to 3 days.


There are 2 windows of reference when summing the volume:
1) The Recent volume window -> sums the volume between the current candle and the start of the window
2) The previous volume window -> sums the volume from the start of the current window until the start of the previous window
An example follows at the end :)


How to set up:
1) In settings, select the Timeframe; weekly, daily and hourly (W,D,H) are supported.
2) Choose the multiplier of the recent timeframe (for example 4 for cumulative volume over the last 4h)
3) Choose the multiplier of the previous timeframe (for example 8, if you want cumulative volume of the 8h before the start of the recent window)


Example:
Settings:
Timeframe: D
Recent volume multiplier: 3
Previous volume multiplier: 1
The chart set to 1h timeframe

This will calculate the cumulative volume for the past 24h, starting at the recent candle. Then it will calculate the cumulative volume for 72 hours before the start of the recent (24h) window. So in total it will need 24 + 72 = 96 hours of data to calculate.
After that it will compare the volume of the recent window with the average of the previous window. If values are above 1 the volume is increasing, if below 1 it is decreasing.

Why is this useful?
It's easy to spot changes in the volume and see if the volume is increasing and by how much, compared to previous days. Of course volume also drives liquidity. If volume is picking up, that could be the start of a bigger move.


WARNING!!!
Use on very low timeframes (1m, 3m) with big lookback periods (W) can break the script or make it execute very slowly due to the nature of the indicator.
Because this works on bar data it's possible that changing timeframes will change the calculation slightly. Generally, lower timeframes produce more accurate results, but take longer to calculate. The selected timeframe for the indicator should always be higher than the timeframe of the chart, otherwise the calculations won't make sense.

Leave a comment or send a DM for any improvements, bugs or ideas for automation / algo trading.
relativevolumeVolume IndicatorVolume

Script protégé

Ce script est publié en code source fermé et vous pouvez l'utiliser librement. Vous pouvez le préférer pour l'utiliser sur un graphique. Vous ne pouvez pas visualiser ou modifier son code source.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité