Woodie_Pivots.efs

ICE Data Services -

Woodie_Pivots.efs    

File Name: Woodie_Pivots.efs

Description:
Contains Pivot Points based on theories by Woodie.

 

Formula Parameters:
NA

 

Notes:
NA

Download File:
Woodie_Pivots.efs



EFS Code:

/************************Copyright eSignal, 2003*************************/
/*Description: Contains Pivot Points based on theories by Woodie. 
PP = (YesterdaysHigh + YesterdaysLow + (TodaysOpen x 2)) / 4 R1 = (PP x 2) - YesterdaysLow S1 = (PP x 2) - YesterdaysHigh R2 = PP + R1 - S1 S2 = PP - R1 + S1 R3 = PP + R2 - S2 S3 = PP - R2 + S2*/
function preMain(){
	setPriceStudy(true);
	setStudyTitle("Woodie Pivots");
	setCursorLabelName("PP-R3", 0);
	setCursorLabelName("PP-R2", 1);
	setCursorLabelName("PP-R1", 2);
	setCursorLabelName("PP", 3);
	setCursorLabelName("PP-S1", 4);
	setCursorLabelName("PP-S2", 5);
	setCursorLabelName("PP-S3", 6); // R3 
	setDefaultBarStyle(PS_SOLID, 0);
	setDefaultBarFgColor(Color.RGB(255, 0, 255), 0);
	setDefaultBarThickness(3, 0); // R2
	setDefaultBarStyle(PS_DASH, 1);
	setDefaultBarFgColor(Color.RGB(255, 0, 0), 1);
	setDefaultBarThickness(2, 1); // R1 
	setDefaultBarStyle(PS_DOT, 2);
	setDefaultBarFgColor(Color.RGB(0, 0, 255), 2);
	setDefaultBarThickness(1, 2); // Woodie Pivot Point 
	setDefaultBarStyle(PS_SOLID, 3);
	setDefaultBarFgColor(Color.RGB(0, 0, 0), 3);
	setDefaultBarThickness(1, 3); // S1 
	setDefaultBarStyle(PS_DOT, 4);
	setDefaultBarFgColor(Color.RGB(0, 0, 255), 4);
	setDefaultBarThickness(1, 4); // S2 
	setDefaultBarStyle(PS_DASH, 5);
	setDefaultBarFgColor(Color.RGB(255, 0, 0), 5);
	setDefaultBarThickness(2, 5); // S3 
	setDefaultBarStyle(PS_SOLID, 6);
	setDefaultBarFgColor(Color.RGB(255, 0, 255), 6);
	setDefaultBarThickness(2, 6);
} // Start of Performance addition
var vLastRawTime = null;
var vLastPP = null;
var vLastPPR1 = null;
var vLastPPR2 = null;
var vLastPPS1 = null;
var vLastPPS2 = null;
var vLastArray = null;
var vSymbol = null;
var vInterval = null;
var vReset = true;

function main(){
	var vH;
	var vL;
	var vC;
	var vRawTime;
	var vBarTime;
	var vIndex;
	var nState = getBarState();
	if (vReset == true)	{
		vLastRawTime = null;
		vLastArray = null;
		vLastPP = null;
		vLastPPR1 = null;
		vLastPPR2 = null;
		vLastPPS1 = null;
		vLastPPS2 = null;
		vInterval = getInterval();
		vSymbol = getSymbol();
		vSymbol += ",D";
		vReset = false;
	}
	vRawTime = getDay();
	if (vRawTime == null) return; // Start of Performance addition 
	if (vRawTime != null && vLastRawTime != null){
		if (vRawTime == vLastRawTime){
			return vLastArray;
		}
	}
	if (vInterval == null) return null;
	if (vInterval == "D") return null;
	if (vInterval == "W") return null;
	if (vInterval == "M") return null;
	if (vInterval == "T") return null;
	vBarTime = getValue("time");
	if (vBarTime != null){
		var vDay = vBarTime.getDay();
		if (vDay == 0){
			var vDate = vBarTime.getDate();
			vDate -= 2;
			vBarTime.setDate(vDate);
		}
		vAbsTime = getPreviousTradingDay(vBarTime, vSymbol);
		if (vAbsTime == null){
			return;
		}
		vIndex = getFirstBarIndexOfDay(vAbsTime, vSymbol);
		if (vIndex != null){
			vH = getValueAbsolute("High", vIndex, vSymbol);
			vL = getValueAbsolute("Low", vIndex, vSymbol);
			vO = getValueAbsolute("Open", vIndex + 1, vSymbol);
			if (vH != null && vL != null && vO != null){
				vLastPP = (vH + vL + (vO * 2)) / 4;
				vLastPPR1 = 2 * vLastPP - vL;
				vLastPPS1 = 2 * vLastPP - vH;
				vLastPPR2 = (vLastPP - vLastPPS1) + vLastPPR1;
				vLastPPS2 = vLastPP - (vLastPPR1 - vLastPPS1);
				vLastPPR3 = (vLastPP - vLastPPS2) + vLastPPR2;
				vLastPPS3 = vLastPP - (vLastPPR2 - vLastPPS2);
				vLastRawTime = vRawTime;
				vLastArray = new Array(vLastPPR3, vLastPPR2, vLastPPR1, vLastPP, vLastPPS1, vLastPPS2, vLastPPS3);
				return vLastArray;
			}
		}
	}
	return null;
}