Home | Newsletter | Testimonials | Trade Equity | Other Formulas | Products

MetaStock Tips - Creating a Volume-by-Price Indicator

Over time I've had several enquiries about my "Volume by Price" indicators. What do they tell us and how they work? The concept is a simple one where the aim is to plot a horizontally oriented volume histogram in the same window as the price chart. The indicator signals which prices have generated the greatest volume over a nominated look-back period. The assumption is that prices trading at higher volumes should point to significant support and/or resistance levels.

When creating these formulas I assumed that many users would wish to set a specific range of price bars to include in any volume-by-price calculation.  might prefer to use all bars loaded. Such choices can be accommodated reasonably easily with this type of indicator, as can the price used for the calculation. I wouldn't recommend basing volume calculations on O, H or L, but there is a valid case for using C, Typical or Mean prices. CLOSE is used for the base indicator under discussion but substituting another price isn't difficult to do.

Some of my Volume by Price formulas include a three-sided box to enclose price bars included in the volume calculations. This box also frames the price range of those bars. The box is not a perfect rectangle but it does form an envelope for the price and volume activity under scrutiny.

Each bar of the horizontal histogram visually represents a percentage of the total volume for any specified look-back range. The accuracy of that percentage inevitably falls away when fewer bars are included. Each bar of the histogram can only start from the centre line of a price bar and this also introduces a small degree of inaccuracy. To illustrate this point, consider an indicator based upon just 50 price bars. At best each horizontal bar will be restricted to increments of 2% because each price bar step equates to 2% (1 bar in a total range of 50 bars). Let's not get carried away though. Volume-by-price is only a visual indicator. It's just meant to be a rough guide to volume activity - no one should expect the precision of an atomic clock.

It would be nice if I could rewrite one indicator using more expressive variable names to help you get a feel for what's going on inside a "Volume by Price" indicator Unfortunately this would have the effect of adding more characters than MetaStock allows. Therefore, what I will do is provide a thorough explanation of each variable for the volume-by-price indicator reproduced in
Figure 7. Where a secondary definition is used with the same variable name I'll explain each definition in the sequence in which it is defined.

Variable Names
D, N, F, G, A, B, Q, R, I, X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, M.

You'll notice that variable "D" is redefined once and variable "M" is redefined 3 times. Even so, all 20 allowed variable names are used.

The indicator starts by defining "D". Its function is to allow the user to select the look-back range. A value of 0 will use all data loaded rather than a set number of bars. The default value is set to 100 bars.

The following redefinition of "D" changes a zero value (0) to the actual number of bars loaded. Note, however, that it will leave "D" unchanged if the initial setting was something other than zero. After this point the "D" variable could return any value from 1 (a minimum of 50 bars is recommended) up to the total number of bars loaded.

The "N" variable allows the user to scale the histogram in order to achieve an optimum display. A setting of 100 (%) adjusts the relative length of all volume plots such that the longest plot extends back the full length (100%) of the enclosing box. All lesser plots are scaled accordingly. A setting of 1 prevents any artificial scaling. For that setting a volume bar extending back 20% of the box (20 bars of a 100-bar box for example) would indicate that the relevant price range represented 20% of total box volume.

You can obtain the complete and original MSTT Volume by Price article by requesting a sample and including "Volume by price" in your email.

Request a free sample of MSTT