File Name: Modified_PVT.efs
Description:
Modified Price-Volume Trend Indicator
Formula Parameters:
Level : 0
Scale : 1
Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit www.traders.com.
Download File:
Modified_PVT.efs
EFS Code:
Description:
Modified Price-Volume Trend Indicator
Formula Parameters:
Level : 0
Scale : 1
Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit www.traders.com.
Download File:
Modified_PVT.efs
EFS Code:
PHP Code:
/*********************************
Provided By:
eSignal (Copyright c eSignal), a division of Interactive Data
Corporation. 2010. All rights reserved. This sample eSignal
Formula Script (EFS) is for educational purposes only and may be
modified and saved under a new file name. eSignal is not responsible
for the functionality once modified. eSignal reserves the right
to modify and overwrite this EFS file with each new release.
Description:
Modified Price-Volume Trend Indicator
Version: 1.00 02/09/2010
Formula Parameters: Default:
Level 0
Scale 1
Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit [url]www.traders.com.[/url]
**********************************/
var fpArray = new Array();
var bInit = false;
var bVersion = null;
function preMain() {
setPriceStudy(false);
setShowCursorLabel(true);
setShowTitleParameters(false);
setStudyTitle("Modified PVT");
setCursorLabelName("MPVT", 0);
setDefaultBarFgColor(Color.red, 0);
setPlotType(PLOTTYPE_LINE, 0);
setDefaultBarThickness(2, 0);
var x=0;
fpArray[x] = new FunctionParameter("Level", FunctionParameter.NUMBER);
with(fpArray[x++]){
setName("Level");
setLowerLimit(-1000);
setUpperLimit(10000);
setDefault(0);
}
fpArray[x] = new FunctionParameter("Scale", FunctionParameter.NUMBER);
with(fpArray[x++]){
setName("Scale");
setLowerLimit(0.0001);
setUpperLimit(100000);
setDefault(1);
}
}
var xMPVT = null;
function main(Level, Scale) {
var nBarState = getBarState();
var nMPVT = 0;
if (bVersion == null) bVersion = verify();
if (bVersion == false) return;
if (nBarState == BARSTATE_ALLBARS) {
if (Level == null) Level = 0;
if (Scale == null) Scale = 1;
}
if (!bInit) {
xMPVT = efsInternal("Calc_MPVT", Level, Scale);
bInit = true;
}
nMPVT = xMPVT.getValue(0);
if (nMPVT == null) return;
return nMPVT;
}
var bSecondInit = false;
var xCumPVT = 0;
function Calc_MPVT(Level, Scale) {
var nRes = 0;
var nCumPVT = 0;
if (!bSecondInit) {
xCumPVT = efsInternal("Calc_CumPVT");
bSecondInit = true;
}
nCumPVT = xCumPVT.getValue(0);
if (nCumPVT == null) return;
nRes = Level + Scale * nCumPVT;
return nRes;
}
var bThirdInit = false;
var xOHLC4 = null;
var xV = null;
function Calc_CumPVT() {
var nRes = 0;
var nRef = 0;
var nOHLC4 = 0;
var nOHLC4_1 = 0;
var rV = 0;
if (!bThirdInit) {
xOHLC4 = ohlc4();
xV = volume();
X = obv();
bThirdInit = true;
}
nOHLC4 = xOHLC4.getValue(0);
nOHLC4_1 = xOHLC4.getValue(-1);
nRef = ref(-1);
if (nOHLC4_1 == null) return;
rV = xV.getValue(0) / 50000;
nRes = nRef + (rV * (nOHLC4 - nOHLC4_1) / nOHLC4_1);
return nRes;
}
function verify() {
var b = false;
if (getBuildNumber() < 779) {
drawTextAbsolute(5, 35, "This study requires version 8.0 or later.",
Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
null, 13, "error");
drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp",
Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
null, 13, "upgrade");
return b;
} else {
b = true;
}
return b;
}