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: 34 times

Percent Volume Oscillator (PVO)

Postby Laurent » 10 Feb 2011

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

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

Re: Percent Volume Oscillator (PVO)

Postby synonym » 13 Jun 2018

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)

Postby synonym » 13 Jun 2018

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)

Postby synonym » 14 Jun 2018

Hi TJ,

did you get Laurent's PVO to work?

Thank you
Syn

User avatar
TJ
Posts: 7739
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1032 times
Been thanked: 2221 times

Re: Percent Volume Oscillator (PVO)

Postby TJ » 14 Jun 2018

Hi TJ,

did you get Laurent's PVO to work?

Thank you
Syn

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

User avatar
rrams
Posts: 128
Joined: 10 Feb 2011
Location: USA
Has thanked: 7 times
Been thanked: 70 times
Contact:

Re: Percent Volume Oscillator (PVO)

Postby rrams » 14 Jun 2018

PVO.png
(3.42 KiB) Downloaded 790 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)

Postby synonym » 15 Jun 2018

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

User avatar
rrams
Posts: 128
Joined: 10 Feb 2011
Location: USA
Has thanked: 7 times
Been thanked: 70 times
Contact:

Re: Percent Volume Oscillator (PVO)

Postby rrams » 15 Jun 2018

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 538 times

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

Re: Percent Volume Oscillator (PVO)

Postby synonym » 15 Jun 2018

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.


Return to “User Contributed Studies and Indicator Library”