# Percent Volume Oscillator (PVO)

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
Laurent
Posts: 159
Joined: 20 Nov 2010
Location: France
Has thanked: 76 times
Been thanked: 33 times

### Percent Volume Oscillator (PVO)

The description:
http://www.marketvolume.com/technicalanalysis/pvo.asp

The code I have written:

Code: Select all

// PVO - Percent Volume Oscillator - Function

Inputs:
Series ( NumericSeries ),   // Volume or Ticks
FastLen ( NumericSimple ),
SlowLen ( NumericSimple );

Variables:
AvFast ( 0 ),
AvSlow ( 0 );

AvFast = XAverage(Series, FastLen);
AvSlow = XAverage(Series, SlowLen);

if (AvSlow > 0) then
PVO = (AvFast - AvSlow) / AvSlow * 100;

Code: Select all

// PVO - Percent Volume Oscillator - Indicator

Inputs:
AnyVol ( Volume ),   // Volume or Ticks
FastLength ( 14 ),
SlowLength ( 28 ),
Zero ( 0 ),
Displace ( 0 );

Variables:
MyPVO ( 0 );

MyPVO = PVO(AnyVol, FastLength, SlowLength);

Plot1[Displace](MyPVO, "PVO");
Plot2(Zero, "Zero");

synonym
Posts: 70
Joined: 20 Feb 2009
Has thanked: 10 times
Been thanked: 3 times

### Re: Percent Volume Oscillator (PVO)

Thank you very much for the code Laurent. I've been looking for PVO on MC.

Note for others. For the Function code I think it the variables need to be written as follows (with PVO added) as it won't compile otherwise.

Variables:
AvFast ( 0 ),
AvSlow ( 0 ),
PVO ( 0 );

synonym
Posts: 70
Joined: 20 Feb 2009
Has thanked: 10 times
Been thanked: 3 times

### Re: Percent Volume Oscillator (PVO)

Has Anyone get Laurent's PVO to plot correctly - It compiles, but it's just a flat line on the chart at 0...

Would appreciate it if anyone has got this to work, or has some other code for it.

Thanks
SYn

synonym
Posts: 70
Joined: 20 Feb 2009
Has thanked: 10 times
Been thanked: 3 times

### Re: Percent Volume Oscillator (PVO)

Hi TJ,

did you get Laurent's PVO to work?

Thank you
Syn

TJ
Posts: 7122
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 987 times
Been thanked: 2032 times

### Re: Percent Volume Oscillator (PVO)

synonym wrote:Hi TJ,

did you get Laurent's PVO to work?

Thank you
Syn

I don't remember; it's been a long time.

rrams
Posts: 51
Joined: 10 Feb 2011
Location: Arizona
Has thanked: 4 times
Been thanked: 23 times
Contact:

### Re: Percent Volume Oscillator (PVO)

PVO.png (3.42 KiB) Viewed 566 times

It works fine.

Code: Select all

// PVO - Percent Volume Oscillator - Function
Inputs:  Series(NumericSeries),   // Volume or Ticks
FastLen(NumericSimple),
SlowLen(NumericSimple);
Vars:    AvFast(0), AvSlow(0);
AvFast=XAverage(Series, FastLen);
AvSlow=XAverage(Series, SlowLen);
if(AvSlow>0) then PVO=(AvFast-AvSlow)/AvSlow*100 else PVO=0;

synonym
Posts: 70
Joined: 20 Feb 2009
Has thanked: 10 times
Been thanked: 3 times

### Re: Percent Volume Oscillator (PVO)

Hi RRams

whenever i try to compile (compiling as a function or indicator), PVO remains grey and i get the following message with PVO being highlighted.

------ Compiled with error(s): ------
assignment is allowed only for variables or array elements
line 8, column 18

I don't understand what i'm missing

Thanks
Syn

rrams
Posts: 51
Joined: 10 Feb 2011
Location: Arizona
Has thanked: 4 times
Been thanked: 23 times
Contact:

### Re: Percent Volume Oscillator (PVO)

Hello synonym.

The function name itself acts as a variable that can be referenced without declaring in the code. You have to make sure the function name is spelled exactly the same as the variable you reference.

TJ is a wiser man and a better teacher than I. He would send you to the proper links to study the methodology. I don't care as much so here's my code
PVO.pla

synonym
Posts: 70
Joined: 20 Feb 2009
Has thanked: 10 times
Been thanked: 3 times

### Re: Percent Volume Oscillator (PVO)

You must be up late!

Thank you for the code RRam! Works great. Comparing yours and mine i simply can't see why it won't compile.