Author: Copyright � 2006, TrendLaboratory Ltd.
PVT_v1

This indicator, known as the Price Volume Trend (PVT), is designed to provide a visual representation of the flow of money within a financial market. Unlike basic volume indicators that simply show how much trading activity occurred, this tool combines price movement with volume data to highlight whether the active buying or selling pressure is driving the current trend.

How the Logic Works

The core objective of this script is to measure "cumulative" activity. It looks at two primary pieces of information: the total volume traded and the percentage change in price over a specific timeframe.

1. The Starting Point The indicator identifies a specific starting point on the chart based on your chosen settings. From that point forward, it begins recording the relationship between price changes and the amount of volume traded at each step.

2. Calculating the Trend For every new candle or time period on the chart, the logic performs a three-step calculation:

  • Price Comparison: It compares the current price to the price from a previous period (determined by your "BarsBack" setting).
  • Percentage Change: It calculates how much the price has moved as a percentage. This helps distinguish between a small fluctuation and a significant price swing.
  • Volume Weighting: It multiplies that percentage change by the volume of the current period.

3. The Cumulative Effect The most important part of the logic is that it is "cumulative." Instead of showing you just the activity of the current moment, it adds the new calculation to the previous total. This creates a continuous line that grows or shrinks over time.

What This Means for the User

By combining volume and price into a single moving line, the indicator helps filter out "noise."

  • If the line is rising significantly, it suggests that high-volume buying is pushing prices upward.
  • If the line is falling, it indicates that selling pressure is dominant.
  • When the line moves relatively flat, it suggests a lack of conviction or a period of consolidation where neither buyers nor sellers are gaining significant ground.

Ultimately, this tool allows you to see the "momentum" of the market by visualizing how much volume is actually supporting the current price direction.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
PVT_v1
//+------------------------------------------------------------------+
//|                                                       PVT_v1.mq4 |
//|                           Copyright © 2006, TrendLaboratory Ltd. |
//|            http://finance.groups.yahoo.com/group/TrendLaboratory |
//|                                       E-mail: igorad2004@list.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, TrendLaboratory Ltd."
#property link      "http://finance.groups.yahoo.com/group/TrendLaboratory"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
//---- input parameters
extern int Price     =0;
extern int BarsBack  =1;
//---- buffers
double PVT[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
//---- indicator buffer mapping
   SetIndexBuffer(0,PVT);
//---- indicator line
   SetIndexStyle(0,DRAW_LINE);
//---- name for DataWindow and indicator subwindow label
   string short_name="PVT("+Price+","+BarsBack+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,"PVT");
   SetIndexDrawBegin(0,BarsBack);
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Price and Volume Trend                                           |
//+------------------------------------------------------------------+
int start()
{
   int   i,limit,counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   if(counted_bars==0) limit=Bars-BarsBack;
   limit=Bars-counted_bars+BarsBack;
//---- 
   for(i=limit; i>=0; i--)
   {
      if(i==Bars-BarsBack) PVT[i]=Volume[i];
      else
      {
      double CurPrice  = iMA(NULL,0,1,0,0,Price,i);
      double PrevPrice = iMA(NULL,0,1,0,0,Price,i+BarsBack);
      
      if(PrevPrice>0)
      PVT[i] = Volume[i]*(CurPrice-PrevPrice)/PrevPrice + PVT[i+1]; 
      }
   }
//----
   return(0);
}

Comments