PRV.efs
EFSLibrary - Discussion Board
File Name: PRV.efs
Description:
Pro Rata Volume
Formula Parameters:
- Line Thickness: 2
- Color PRV: Red
- Color Volume: Green
- Display Cursor Labels: True
Notes:
The balance of power indicator measures the strength of the bulls vs. bears by assessing the ability of each to push price to an extreme level.
Download File:
PRV.efs
EFS Code:
/********************************* Provided By: eSignal (Copyright c eSignal), a division of Interactive Data Corporation. 2008. 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: Pro Rata Volume Version: 1.0 10/06/2008 Notes: The balance of power indicator measures the strength of the bulls vs. bears by assessing the ability of each to push price to an extreme level. Formula Parameters: Default: Line Thickness 2 Color PRV Red Color Volume Green Display Cursor Labels True **********************************/ var fpArray = new Array(); var bInit = false; function preMain() { setPriceStudy(false); setShowCursorLabel(false); setShowTitleParameters( false ); setStudyTitle("Pro Rata Volume"); setCursorLabelName("Volume", 0); setDefaultBarFgColor(Color.red, 0); setPlotType(PLOTTYPE_HISTOGRAM, 0); setDefaultBarThickness(2, 0); askForInput(); var x=0; fpArray[x] = new FunctionParameter("LineColor1", FunctionParameter.COLOR); with(fpArray[x++]){ setName("Color PRV"); setDefault(Color.red); } fpArray[x] = new FunctionParameter("LineColor2", FunctionParameter.COLOR); with(fpArray[x++]){ setName("Color Volume"); setDefault(Color.green); } fpArray[x] = new FunctionParameter("ViewValue", FunctionParameter.BOOLEAN); with(fpArray[x++]){ setName("Display Cursor Labels"); setDefault(true); } fpArray[x] = new FunctionParameter("Thickness", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Line Thickness"); setLowerLimit(1); setDefault(2); } } var nHour = 0; var nMinute = 0; var nSecond = 0; function main(Thickness, LineColor1, LineColor2, ViewValue) { var nState = getBarState(); var nEndTime = 0; var nVolume = 0; var vInt = (getInterval() * 60); var PercentComplete = 0; if ( bInit == false ) { setDefaultBarFgColor(LineColor1, 0); setDefaultBarThickness(Thickness, 0); setShowCursorLabel(ViewValue); bInit = true; } if (!isIntraday()) { setStudyTitle("Sorry. This script run only intraday charts."); return; } else { if (getCurrentBarCount() == getNumBars()) { setStudyTitle("Pro Rata Volume"); Timer(); nEndTime = (nHour * 3600) + (nMinute * 60) + nSecond; PercentComplete = (1 - ((nEndTime * 100 / vInt) * 0.01)); if (PercentComplete < 0.02) nVolume = volume(0) else nVolume = Math.floor(volume(0) / PercentComplete); if (nVolume < volume(0)) nVolume = volume(0); } else { nVolume = volume(0); } } drawLineRelative( 0, 0, 0, nVolume, PS_SOLID, Thickness, LineColor2, 105 ); drawLineRelative( 0, 0, 0, volume(0), PS_SOLID, Thickness, LineColor1, 106 ); return volume(0); } var vTimeStamp = null; var vInt = null; function Timer() { if (!isIntraday() || getCurrentBarIndex() < -1) return; var nState = getBarState(); var vClockTime = new Date()*1; if (vInt == null) vInt = (getInterval()*60000); // convert to milliseconds if (nState == BARSTATE_NEWBAR) { vTimeStamp = getValue("Time")*1 + vInt; } var vTimeLeft = (vTimeStamp - vClockTime); if (vTimeLeft < 0) return; var vHr = 0; var vMin = 0; var vSec = 0; if (vInt > 3600000) { vHr = Math.floor(vTimeLeft/3600000); vTimeLeft -= (vHr*3600000); } if (vInt > 60000) { vMin = Math.floor(vTimeLeft/60000); vTimeLeft -= (vMin*60000); } vSec = Math.floor(vTimeLeft/1000); vTimeLeft = (" " + vHr + ":" + vMin + ":" + vSec + " "); nHour = vHr; nMinute = vMin; nSecond = vSec; return; }