Working Money magazine.  The investors' magazine.
Traders.com Advantage

INDICATORS LIST


LIST OF TOPICS





Article Archive | Search | Subscribe/Renew | Login | Free Trial | Forgot ID?


PRINT THIS ARTICLE


Code For PVI & NVI Indicators

05/19/00 11:59:48 AM
by Han Kim

In a continuation of my previous article, "Positive Volume Index Or Negative Volume Index", I'm supplying the code for both indexes in Easylanguage (ELA), for TradeStation, and as an Excel spreadsheet (XLS).

Security:   N/A
Position:   N/A

Click here to view the related article "Positive Volume Index Or Negative Volume Index".

Here's how to calculate positive volume index (PVI) and negative volume index (NVI):

TC = Today's close
YC = Yesterday's close

If today's volume is greater than yesterday's volume:

PVI = yesterday's PVI + (((TC - YC) / YC) * yesterday's PVI)
NVI = yesterday's NVI

If today's volume is less than yesterday's volume:

NVI = yesterday's NVI + (((TC - YC) / YC) * yesterday's NVI)
PVI = yesterday's PVI

If today's volume equals yesterday's volume:

PVI = yesterday's PVI
NVI = yesterday's NVI

Here is the Tradestation code for PVI in Easylanguage:


Inputs: Length(255), Displace(0);
Variables: PVI(100), InitValue(100);
If PVI <> 0 then
InitValue = 0;

IF volume > volume[1] then
PVI = (PVI[1] + InitValue) + (((close - close[1])/close[1]) * (PVI[1] + InitValue));
IF volume <= volume[1] then
PVI = PVI[1];
Plot1(PVI);

If Displace >= 0 OR CurrentBar > AbsValue(Displace) Then Begin
Plot2[Displace](AverageFC(PVI, Length), "PVI-MA");
end;


Here is the Tradestation code for NVI in Easylanguage:


Inputs: Length(255), Displace(0);
Variables: NVI(100), InitValue(100);
If NVI <> 0 then
InitValue = 0;

IF volume < volume[1] then
NVI = (NVI[1] + InitValue) + (((close - close[1])/close[1]) * (NVI[1] + InitValue));
IF volume >= volume[1] then
NVI = NVI[1];
Plot1(NVI);

If Displace >= 0 OR CurrentBar > AbsValue(Displace) Then Begin
Plot2[Displace](AverageFC(NVI, Length), "NVI-MA");
end;


Click here to download the Excel spreadsheet.



Han Kim

Traders.com Advantage Staff Writer

Title: Webmaster
Company: Technical Analysis, Inc.
Address: 4757 California AVE SW
Seattle, WA 98116
Phone # for sales: 206-938-0570
Fax: 206-938-1307
Website: www.traders.com
E-mail address: hkim@traders.com

Traders' Resource Links
Charting the Stock Market: The Wyckoff Method -- Books
Working-Money.com -- Online Trading Services
Traders.com Advantage -- Online Trading Services
Technical Analysis of Stocks & Commodities -- Publications and Newsletters
Working Money, at Working-Money.com -- Publications and Newsletters
Traders.com Advantage -- Publications and Newsletters
Professional Traders Starter Kit -- Software

Click here for more information about our publications!


Comments or Questions? Article Usefulness
5 (most useful)
4
3
2
1 (least useful)

Comments

Date: / /Rank: 5Comment: 
PRINT THIS ARTICLE






S&C Subscription/Renewal




Request Information From Our Sponsors 

DEPARTMENTS: Advertising | Editorial | Circulation | Contact Us | BY PHONE: (206) 938-0570

PTSK — The Professional Traders' Starter Kit
Home — S&C Magazine | Working Money Magazine | Traders.com Advantage | Online Store | Traders’ Resource
Add a Product to Traders’ Resource | Message Boards | Subscribe/Renew | Free Trial Issue | Article Code | Search

Copyright © 1982–2019 Technical Analysis, Inc. All rights reserved. Read our disclaimer & privacy statement.