LazyBear

Price Volume Rank [LazyBear]

Price-Volume Rank, designed by Anthony J. Macek, compares the direction of the change in price (up or down) to the direction of the change in volume and assigns a number to that specific relationship. By quantifying price/volume interaction, P-V rank seeks to determine our position within a typical market cycle.

The various modes shown on the chart above or explained below. Also, read on for a little trick using the new Pine feature that you can use in your script.

How to read the PVR?
-------------------
The most desirable market condition occurs when both price and volume are moving up, that phenomenon is assigned a PVR of 1.

The next most desirable condition, when prices are still moving up but volume is diminishing, is given a PVR of 2. Although still technically healthy, this relationship between price and volume issues a warning that market momentum is weakening.

The worst-case scenario, seen when selling pressure is greatest with prices dropping and volume
increasing, is given PVR's weakest designation, 4.

Finally, even though prices are still moving down, volume begins to diminish as selling pressure abates. This price/volume relationship is assigned a PVR of 3, often alerting us to a potential buying opportunity ahead.

What do the modes mean?
----------------------

1) Histogram Mode: This plots PVR along with helpful ranges. Be careful when PVR is trending at turn-around points.
2) MA Crossover Mode: This plots a slow/fast MA of PVR. Default is 5/10 SMA. Buy is signalled when slow MA falls below fast MA. Sell is signalled when slow MA crosses up fast MA. There is a warning line at 2.5 that can be used for more confirmation.
3) Double Smoothed Crossover Mode: Same as MA crossover, but PVR is smoothed more. Warning line (2.5 level) is very useful in this mode. Use slow MA as the signal and fast MA of PVR for tracking the market.

Misc notes:
-----------
This won't work for Forex and other instruments for which TradingView doesn't expose volume. Thanks to the new Text rendering feature of PlotShape(), I can actually let users know of that :) Good use-case, eh? I will post a sample chart below in the comments.

Feel free to use any part of this code in your indicators.

More info:
--------
Stocks & Commodities V. 12:6 (235-239): Price-Volume Rank by Anthony J. Macek


Complete list of my indicators:
-----------------------------
docs.google.com...ByMEvm5MLo/edit?usp=sharin...

List of my free indicators: bit.ly/1LQaPK8
List of my indicators at Appstore: blog.tradingview.com/?p=970
Script open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?
//
// @author LazyBear 
// List of all my indicators: 
// https://docs.google.com/document/d/15AGCufJZ8CIUvwFJ9W-IKns88gkWOKBCvByMEvm5MLo/edit?usp=sharing
// 
study("Price Volume Rank [LazyBear]", shorttitle="PVR_LB", overlay=false)
showMA=input(true, title="Show MA Crossovers")
ma1=input(5, title="Fast MA Length", defval=5),ma2=input(10, title="Slow MA Length", defval=10)
dblSmoothing=input(false, title="Double Smoothing")
pvr=iff(close>close[1] and volume>volume[1],1,
	iff(close>close[1] and volume<=volume[1],2,
	iff(close<=close[1] and volume<=volume[1],3,4)))
ux=pvr>3.0?pvr:na,lx=pvr<2.0?pvr:na
u=plot(showMA?na:na(volume)?na:2.0, color=green, title="BullLine")
l=plot(showMA?na:na(volume)?na:3.0, color=red, title="BearLine")
fill(u,l,gray)
mal=plot(showMA?na(volume)?na:2.5:na, color=gray, title="MACutoff")
plot(showMA?na:na(volume)?na:pvr, style=histogram, histbase=2, color=pvr>3.0?red:pvr<2.0?green:gray, linewidth=2,transp=40, title="PVR")
plot(showMA?na:na(volume)?na:pvr, style=circles, color=pvr>=3.0?red:pvr<=2.0?green:gray, linewidth=4, title="PVR Points")
sma1=not showMA?na:dblSmoothing?sma(sma(pvr,ma1),ma1):sma(pvr,ma1), sma2=not showMA?na:dblSmoothing?sma(sma(pvr,ma2),ma2):sma(pvr,ma2)
plot(showMA?na(volume)?na:sma1:na, style=linebr, color=red, linewidth=2, title="Fast MA")
plot(showMA?na(volume)?na:sma2:na, style=linebr, color=green, linewidth=1, title="Slow MA")
x=na(volume)?(nz(x[1])+0.4)%4.0:na
plotshape(na(volume)?x:na, style=shape.circle, color=red, text="No volume", location=location.absolute, title="ErrorText")