TradingView

Relative Volume at Time

Dilihat 20520
1472
█ OVERVIEW

This indicator calculates relative volume , which is the ratio of present volume over an average of past volume .
It offers two calculation modes, both using a time reference as an anchor.
                                        

█ CONCEPTS

Calculation modes
The simplest way to calculate relative volume is by using the ratio of a bar's volume over a simple moving average of the last n volume values.
This indicator uses one of two, more subtle ways to calculate both values of the relative volume ratio: current volume:past volume.
The two calculations modes are:
 1 — Cumulate from Beginning of TF to Current Bar where:
   current volume = the cumulative volume since the beginning of the timeframe unit, and
   past volume = the mean of volume during that same relative period of time in the past n timeframe units.
 2 — Point-to-Point Bars at Same Offset from Beginning of TF where:
   current volume = the volume on a single chart bar, and
   past volume = the mean of volume values from that same relative bar in time from the past n timeframe units.

Timeframe units
Timeframe units can be defined in three different ways:
 1 — Using Auto-steps, where the timeframe unit automatically adjusts to the timeframe used on the chart:
    — A 1 min timeframe unit will be used on 1sec charts,
    — 1H will be used for charts at 1min and less,
    — 1D will be used for other intraday chart timeframes,
    — 1W will be used for 1D charts,
    — 1M will be used for charts at less than 1M,
    — 1Y will be used for charts at greater or equal than 1M.
 2 — As a fixed timeframe that you define.
 3 — By time of day (for intraday chart timeframes only), which you also define. If you use non-intraday chart timeframes in this mode, the indicator will switch to Auto-steps.

Relative Relativity
A relative volume value of 1.0 indicates that current volume is equal to the mean of past volume, but how can we determine what constitutes a high relative volume value?
The traditional way is to settle for an arbitrary threshold, with 2.0 often used to indicate that relative volume is worthy of attention.

We wanted to provide traders with a contextual method of calculating threshold values, so in addition to the conventional fixed threshold value,
this indicator includes two methods of calculating a threshold channel on past relative volume values:
 1 — Using the standard deviation of relative volume over a fixed lookback.
 2 — Using the highs/lows of relative volume over a variable lookback.

Channels calculated on relative volume provide meta-relativity, if you will, as they are relative values of relative volume .


█ FEATURES

Controls in the "Display" section of inputs determine what is visible in the indicator's pane. The next "Settings" section is where you configure the parameters used in the calculations. The "Column Coloring Conditions" section controls the color of the columns, which you will see in three of the five display modes available. Whether columns are plotted or not, the coloring conditions also determine when markers appear, if you have chosen to show the markers in the "Display" section. The presence of markers is what triggers the alerts configured on this indicator. Finally, the "Colors" section of inputs allows you to control the color of the indicator's visual components.

Display
Five display modes are available:
 • Current Volume Columns: shows columns of current volume, with past volume displayed as an outlined column.
 • Relative Volume Columns: shows relative volume as a column.
 • Relative Volume Columns With Average: shows relative volume as a column, with the average of relative volume .
 • Directional Relative Volume Average: shows a line calculated using the average of +/- values of relative volume .
  The positive value of relative volume is used on up bars; its negative value on down bars.
 • Relative Volume Average: shows the average of relative volume .
A Hull moving average is used to calculate the average used in the three last display modes.

You can also control the display of:
 • The value or relative volume , when in the first three display modes. Only the last 500 values will be shown.
 • Timeframe transitions, shown in the background.
 • A reminder of the active timeframe unit, which appears to the right of the indicator's last bar.
 • The threshold used, which can be a fixed value or a channel, as determined in the next "Settings" section of inputs.
 • Up/Down markers, which appear on transitions of the color of the volume columns (determined by coloring conditions), which in turn control when alerts are triggered.
 • Conditions of high volatility .

Settings
Use this section of inputs to change:
 • Calculation mode: this is where you select one of this indicator's two calculation modes for current volume and past volume, as explained in the "Concepts" section.
 • Past Volume Lookback in TF units: the quantity of timeframe units used in the calculation of past volume.
 • Define Timeframes Units Using: the mode used to determine what one timeframe unit is. Note that when using a fixed timeframe, it must be higher than the chart's timeframe.
  Also, note that time of day timeframe units only work on intraday chart timeframes.
 • Threshold Mode: Five different modes can be selected:
   — Fixed Value: You can define the value using the "Fixed Threshold" field below. The default value is 2.0.
   — Standard Deviation Channel From Fixed Lookback: This is a channel calculated using the simple moving average of relative volume
    (so not the Hull moving average used elsewhere in the indicator), plus/minus the standard deviation multiplied by a user-defined factor.
    The lookback used is the value of the "Channel Lookback" field. Its default is 100.
   — High/Low Channel From Beginning of TF: in this mode, the High/Low values reset at the beginning of each timeframe unit.
   — High/Low Channel From Beginning of Past Volume Lookback: in this mode, the High/Low values start from the farthest point back where we are calculating past volume,
    which is determined by the combination of timeframe units and the "Past Volume Lookback in TF units" value.
   — High/Low Channel From Fixed Lookback: In this mode the lookback is fixed. You can define the value using the "Channel Lookback" field. The default value is 100.
 • Period of RelVol Moving Average: the period of the Hull moving average used in the "Directional Relative Volume Average" and the "Relative Volume Average".
 • High Volatility is defined using fast and slow ATR periods, so this represents the volatility of price.
  Volatility is considered to be high when the fast ATR value is greater than its slow value. Volatility can be used as a filter in the column coloring conditions.

Column Coloring Conditions
 • Eight different conditions can be turned on or off to determine the color of the volume columns. All "ON" conditions must be met to determine a high/low state of relative volume ,
  or, in the case of directional relative volume , a bull/bear state.
 • A volatility state can also be used to filter the conditions.
 • When the coloring conditions and the filter do not allow for a high/low state to be determined, the neutral color is used.
 • Transitions of the color of the volume columns determined by coloring conditions are used to plot the up/down markers, which in turn control when alerts are triggered.

Colors
 • You can define your own colors for all of the oscillator's plots.
 • The default colors will perform well on light or dark chart backgrounds.

Alerts
 • An alert can be defined for the script. The alert will trigger whenever an up/down marker appears in the indicator's display.
  The particular combination of coloring conditions and the display settings for up/down markers when you create the alert will determine which conditions trigger the alert.
  After alerts are created, subsequent changes to the conditions controlling the display of markers will not affect existing alerts.
 • By configuring the script's inputs in different ways before you create your alerts, you can create multiple, functionally distinct alerts from this script.
  When creating multiple alerts, it is useful to include in the alert's message a reminder of the particular conditions you used for each alert.
 • As is usually the case, alerts triggering "Once Per Bar Close" will prevent repainting.

Error messages
Error messages will appear at the end of the chart upon the following conditions:
 • When the combination of the timeframe units used and the "Past Volume Lookback in TF units" value create a lookback that is greater than 5000 bars.
  The lookback will then be recalculated to a value such that a runtime error does not occur.
 • If the chart's timeframe is higher than the timeframe units. This error cannot occur when using Auto-steps to calculate timeframe units.
 • If relative volume cannot be calculated, for example, when no volume data is available for the chart's symbol.
 • When the threshold of relative volume is configured to be visible but the indicator's scale does not allow it to be visible (in "Current Volume Columns" display mode).


█ NOTES

For traders
The chart shown here uses the following display modes: "Current Volume Columns", "Relative Volume Columns With Average", "Directional Relative Volume Average" and "Relative Volume Average". The last one also shows the threshold channel in standard deviation mode, and the TF Unit reminder to the right, in red.

Volume , like price, is a value with a market-dependent scale. The only valid reference for volume being its past values, any improvement in the way past volume is calculated thus represents a potential opportunity to traders. Relative volume calculated as it is here can help traders extract useful information from markets in many circumstances, markets with cyclical volume such as Forex being one, obvious case. The relative nature of the values calculated by this indicator also make it a natural fit for cross-market and cross-sector analysis, or to identify behavioral changes in the different futures contracts of the same market. Relative volume can also be put to more exotic uses, such as in evaluating changes in the popularity of exchanges.

Relative volume alone has no directional bias. While higher relative volume values always indicate higher trading activity, that activity does not necessarily translate into significant price movement. In a tightly fought battle between buyers and sellers, you could theoretically have very large volume for many bars, with no change whatsoever in bid/ask prices. This of course, is unlikely to happen in reality, and so traders are justified in considering high relative volume values as indicating periods where more attention is required, because imbalances in the strength of buying/selling power during high-volume trading periods can amplify price variations, providing traders with the generally useful gift of volatility .

Be sure to give the "Directional Relative Volume Average" a try. Contrary to the always-positive ratio widely used in this indicator, the "Directional Relative Volume Average" produces a value able to determine a bullish / bearish bias for relative volume .

Note that realtime bars must be complete for the relative volume value to be confirmed. Values calculated on historical or elapsed realtime bars will not recalculate unless historical volume data changes.

Finally, as with all indicators using volume information, keep in mind that some exchanges/brokers supply different feeds for intraday and daily data, and the volume data on both feeds can sometimes vary quite a bit.

For coders
Our script was written using the PineCoders Coding Conventions for Pine.
The description was formatted using the techniques explained in the How We Write and Format Script Descriptions PineCoders publication.
Bits and pieces of code were lifted from the MTF Selection Framework and the MTF Oscillator Framework, also by PineCoders.

█ THANKS

Thanks to dgtrd for suggesting to add the channel using standard deviation.
Thanks to adolgov for helpful suggestions on calculations and visuals.
Catatan Rilis: v 1.1
Made a few cosmetic changes. No functional changes.
Skrip open-source

Sejalan dengan semangat TradingView, penulis skrip ini telah mempublikasikannya secara open-source, sehingga para trader dapat memahami dan memverifikasinya. Salut untuk sang penulis! Anda dapat menggunakannya secara gratis, tetapi penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk dapat menggunakannya didalam sebuah chart.

Inggin menggunakan skrip ini pada chart?
Get $30 worth of TradingView Coins for you and a friend: https://www.tradingview.com/share-your-love/

Read more about the new tools and features we're building for you: https://www.tradingview.com/blog/en/

Komentar

This is exactly what everybody was waiting for I am sure. Thank you TV
+9 Jawab
I'm not clear what this exactly does. It looks like weis wave, is this a sort of volume-weighted momentum indicator? Does it predict changes in the trend?
+3 Jawab
LucF justinsandell
@justinsandell, It helps traders visualize how important current volume is compared to past volume. As is explained in the "Concepts" section of the description, yes, one of the calculation methods it can use cumulates present and past volumes. But whereas Weis Wave uses changes in a trend to reset the cumulative count, this indicator uses changes in timeframe units, which you can define. So the cumulative volume can reset each day, for example.

The indicator's default settings make it work like the better time-based Relative Volume indicators on other platforms, but we've also added lots of goodies you may find worth exploring if you are interested in Relative Volume.
+8 Jawab
@LucF, I wonder if you could come up with the Weis Wave Indicator, that puts volume values on chart since it is now possible with the new Pine Script. It would be very helpful for our community. Thank you!
Jawab
LucF OlegDaze
@OlegDaze, An on-chart Weis Wave more like the one Weis used is in plans.
+1 Jawab
Thanks a lot :)
+3 Jawab


sometimes it shows 0.00 all the day for a day. It that an error?
Jawab
This seems like a very interesting indicator but I am not quite sure how to use it? Any chance you could do a video on it?
Jawab
Hi LucF
Could you pls tell me why this indicator does this? I have this indicator on 7 screens but it does this only one one of them and that too in the morning. If you see the screenshot it corrects itself later in the day..
https://imgur.com/smH0ohg
if you look at the 1st 15 min bar for Amazon it says the current 15 min volume was 1642 times the relative volume for same time over last 5 days. That's not possible
Is there a setting that I need to change to fix this?
Jawab
Hi, I just started playing around with this indicator, trying to plot rules and such. Its been amazing but today almost all candles are coming up blue? Any suggestions.
Jawab