yodaPivotPointAll.efs
File Name: yodaPivotPointAll.efs
Description:
Modification to PivotPointAll.efs. Includes four midpoints between R2, R1, PP, S1 and S2.
Formula Parameters:
NA
Notes:
NA
Download File:
yodaPivotPointAll.efs
yodaPivotPointAll_EFS2.efs
EFS2 Code:
/**************************************************************************************************** Copyright © eSignal, a division of Interactive Data Corporation. 2003. All rights reserved. This sample eSignal Formula Script (EFS) may be modified and saved under a new filename; however, eSignal is no longer responsible for the functionality once modified. eSignal reserves the right to modify and overwrite this EFS file with each new release. @version 2.0 ****************************************************************************************************/ function preMain() { setPriceStudy(true); setStudyTitle("Pivot Points"); setCursorLabelName("PP-R2", 0); setCursorLabelName("PP-R1.5", 1); setCursorLabelName("PP-R1", 2); setCursorLabelName("PP-R0.5", 3); setCursorLabelName("PP", 4); setCursorLabelName("PP-S0.5", 5); setCursorLabelName("PP-S1", 6); setCursorLabelName("PP-S1.5", 7); setCursorLabelName("PP-S2", 8); // R2 setDefaultBarStyle(PS_DASH, 0); setDefaultBarFgColor(Color.RGB(255,0,0), 0); setDefaultBarThickness(2, 0); // R1.5 setDefaultBarStyle(PS_DASH, 1); setDefaultBarFgColor(Color.RGB(255,0,0), 1); setDefaultBarThickness(1, 1); // R1 setDefaultBarStyle(PS_DOT, 2); setDefaultBarFgColor(Color.RGB(0,0,255), 2); setDefaultBarThickness(2, 2); // R0.5 setDefaultBarStyle(PS_DOT, 3); setDefaultBarFgColor(Color.RGB(0,0,255), 3); setDefaultBarThickness(1, 3); // Pivot Point setDefaultBarStyle(PS_SOLID, 4); setDefaultBarFgColor(Color.RGB(0,0,0), 4); setDefaultBarThickness(2, 4); // S0.5 setDefaultBarStyle(PS_DOT, 5); setDefaultBarFgColor(Color.RGB(0,0,255), 5); setDefaultBarThickness(1, 5); // S1 setDefaultBarStyle(PS_DOT, 6); setDefaultBarFgColor(Color.RGB(0,0,255), 6); setDefaultBarThickness(2, 6); // S1.5 setDefaultBarStyle(PS_DASH, 7); setDefaultBarFgColor(Color.RGB(255,0,0), 7); setDefaultBarThickness(1, 7); // S2 setDefaultBarStyle(PS_DASH, 8); setDefaultBarFgColor(Color.RGB(255,0,0), 8); setDefaultBarThickness(2, 8); } // Start of Performance addition var vLastRawTime = null; var vLastPP = null; var vLastPPR0_5 = null; var vLastPPR1 = null; var vLastPPR1_5 = null; var vLastPPR2 = null; var vLastPPS0_5 = null; var vLastPPS1 = null; var vLastPPS1_5 = 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; vLastPPR0_5 = null; vLastPPR1 = null; vLastPPR1_5 = null; vLastPPR2 = null; vLastPPS0_5 = null; vLastPPS1 = null; vLastPPS1_5 = null; vLastPPS2 = null; vInterval = getInterval(); vSymbol = getSymbol(); vSymbol += ",D"; vReset = false; } //vRawTime = getValue("rawtime"); // does not work properly with 1 min interval vRawTime = getDay(); if(vRawTime == null) return; //vRawTime = Math.floor(vRawTime / RawTime.DAY); // Start of Performance addition if(vRawTime != null && vLastRawTime != null) { if(vRawTime == vLastRawTime) { return vLastArray; // return new Array(vLastPP, vLastPPR1, vLastPPR2, vLastPPS1, vLastPPS2); } } 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); vC = getValueAbsolute("Close", vIndex, vSymbol); if(vH != null && vL != null && vC != null) { vLastPP = (vH + vL + vC) / 3; vLastPPR1 = 2 * vLastPP - vL; vLastPPS1 = 2 * vLastPP - vH; vLastPPR2 = (vLastPP - vLastPPS1) + vLastPPR1; vLastPPS2 = vLastPP - (vLastPPR1 - vLastPPS1); vLastRawTime = vRawTime; vLastPPR0_5 = (vLastPP + vLastPPR1)/2; vLastPPR1_5 = (vLastPPR1 + vLastPPR2)/2; vLastPPS0_5 = (vLastPP + vLastPPS1)/2; vLastPPS1_5 = (vLastPPS1 + vLastPPS2)/2; vLastArray = new Array(vLastPPR2, vLastPPR1_5, vLastPPR1, vLastPPR0_5, vLastPP, vLastPPS0_5, vLastPPS1, vLastPPS1_5, vLastPPS2); return vLastArray; } } } return null; }
EFS1 Code:
/*************************************** Provided By : eSignal (c) Copyright 2005 ***************************************/ function preMain() { setPriceStudy(true); setStudyTitle("Yoda Pivot Points EFS2"); setCursorLabelName("PP-R2", 0); setCursorLabelName("PP-R1.5", 1); setCursorLabelName("PP-R1", 2); setCursorLabelName("PP-R0.5", 3); setCursorLabelName("PP", 4); setCursorLabelName("PP-S0.5", 5); setCursorLabelName("PP-S1", 6); setCursorLabelName("PP-S1.5", 7); setCursorLabelName("PP-S2", 8); // R2 setDefaultBarStyle(PS_DASH, 0); setDefaultBarFgColor(Color.RGB(255,0,0), 0); setDefaultBarThickness(2, 0); // R1.5 setDefaultBarStyle(PS_DASH, 1); setDefaultBarFgColor(Color.RGB(255,0,0), 1); setDefaultBarThickness(1, 1); // R1 setDefaultBarStyle(PS_DOT, 2); setDefaultBarFgColor(Color.RGB(0,0,255), 2); setDefaultBarThickness(2, 2); // R0.5 setDefaultBarStyle(PS_DOT, 3); setDefaultBarFgColor(Color.RGB(0,0,255), 3); setDefaultBarThickness(1, 3); // Pivot Point setDefaultBarStyle(PS_SOLID, 4); setDefaultBarFgColor(Color.RGB(0,0,0), 4); setDefaultBarThickness(2, 4); // S0.5 setDefaultBarStyle(PS_DOT, 5); setDefaultBarFgColor(Color.RGB(0,0,255), 5); setDefaultBarThickness(1, 5); // S1 setDefaultBarStyle(PS_DOT, 6); setDefaultBarFgColor(Color.RGB(0,0,255), 6); setDefaultBarThickness(2, 6); // S1.5 setDefaultBarStyle(PS_DASH, 7); setDefaultBarFgColor(Color.RGB(255,0,0), 7); setDefaultBarThickness(1, 7); // S2 setDefaultBarStyle(PS_DASH, 8); setDefaultBarFgColor(Color.RGB(255,0,0), 8); setDefaultBarThickness(2, 8); } var xPP = null; var xPPR0_5 = null; var xPPR1 = null; var xPPR1_5 = null; var xPPR2 = null; var xPPS0_5 = null; var xPPS1 = null; var xPPS1_5 = null; var xPPS2 = null; var bInit = false; var xHigh = null; var xLow = null; var xClose = null; function main() { if (isDWM() || isRawTick()) return; if(bInit == false) { xHigh = high(inv("D")); xLow = low(inv("D")); xClose = close(inv("D")); xPP = efsInternal("calcPP", "PP", getSeries(xHigh), getSeries(xLow), getSeries(xClose), null, null, null ); xPPR1 = efsInternal("calcPP", "PPR1", getSeries(xHigh), getSeries(xLow), getSeries(xClose), xPP, null, null ); xPPS1 = efsInternal("calcPP", "PPS1", getSeries(xHigh), getSeries(xLow), getSeries(xClose), xPP, null, null ); xPPR2 = efsInternal("calcPP", "PPR2", getSeries(xHigh), getSeries(xLow), getSeries(xClose), xPP, xPPS1, xPPR1 ); xPPS2 = efsInternal("calcPP", "PPS2", getSeries(xHigh), getSeries(xLow), getSeries(xClose), xPP, xPPR1, xPPS1 ); xPPR0_5 = efsInternal("calcPP", "PPR0_5", getSeries(xHigh), getSeries(xLow), getSeries(xClose), xPP, xPPR1, null ); xPPR1_5 = efsInternal("calcPP", "PPR1_5", getSeries(xHigh), getSeries(xLow), getSeries(xClose), xPPR1, xPPR2, null ); xPPS0_5 = efsInternal("calcPP", "PPS0_5", getSeries(xHigh), getSeries(xLow), getSeries(xClose), xPP, xPPS1, null ); xPPS1_5 = efsInternal("calcPP", "PPS1_5", getSeries(xHigh), getSeries(xLow), getSeries(xClose), xPPS1, xPPS2, null ); bInit = true; } return new Array(getSeries(xPPR2), getSeries(xPPR1_5), getSeries(xPPR1), getSeries(xPPR0_5), getSeries(xPP), getSeries(xPPS0_5), getSeries(xPPS1), getSeries(xPPS1_5), getSeries(xPPS2)); } function calcPP(type, h, l, c, x1, x2, x3) { var vH = h.getValue(-1); var vL = l.getValue(-1); var vC = c.getValue(-1); if(vH != null && vL != null && vC != null) { switch (type) { case "PP" : return (vH + vL + vC) / 3; break; case "PPR1" : return 2 * x1.getValue(0) - vL; break; case "PPS1" : return 2 * x1.getValue(0) - vH; break; case "PPR2" : return (x1.getValue(0) - x2.getValue(0)) + x3.getValue(0); break; case "PPS2" : return x1.getValue(0) - (x2.getValue(0) - x3.getValue(0)); break; case "PPR0_5" : return (x1.getValue(0) + x2.getValue(0))/2; break; case "PPR1_5" : return (x1.getValue(0) + x2.getValue(0))/2; break; case "PPS0_5" : return (x1.getValue(0) + x2.getValue(0))/2; break; case "PP1_5" : return (x1.getValue(0) + x2.getValue(0))/2; break; default : return null; } } }