Page 1 of 1

Percent Volume Oscillator (PVO)

Posted: 10 Feb 2011
by Laurent
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;


I have added EMA instead of SMA! :)

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");

Re: Percent Volume Oscillator (PVO)

Posted: 13 Jun 2018
by synonym
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 );

Re: Percent Volume Oscillator (PVO)

Posted: 13 Jun 2018
by synonym
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

Re: Percent Volume Oscillator (PVO)

Posted: 14 Jun 2018
by synonym
Hi TJ,

did you get Laurent's PVO to work?

Thank you
Syn

Re: Percent Volume Oscillator (PVO)

Posted: 14 Jun 2018
by TJ
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.

Re: Percent Volume Oscillator (PVO)

Posted: 14 Jun 2018
by rrams
PVO.png
PVO.png (3.42 KiB) Viewed 612 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;

Re: Percent Volume Oscillator (PVO)

Posted: 15 Jun 2018
by synonym
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

Re: Percent Volume Oscillator (PVO)

Posted: 15 Jun 2018
by rrams
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 :P
PVO.pla
(4.14 KiB) Downloaded 200 times

Re: Percent Volume Oscillator (PVO)

Posted: 15 Jun 2018
by synonym
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.