/****************************************************************************************** Copyright © eSignal, a division of Interactive Data Corporation. 2005. 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 3.0 by Alexis Montenegro for eSignal *******************************************************************************************/ function preMain() { setPriceStudy(true); setStudyTitle("Pivot Points"); setCursorLabelName("PP-R2", 0); setCursorLabelName("PP-R1", 1); setCursorLabelName("PP", 2); setCursorLabelName("PP-S1", 3); setCursorLabelName("PP-S2", 4); // R2 setDefaultBarStyle(PS_DASH, 0); setDefaultBarFgColor(Color.RGB(255,0,0), 0); setDefaultBarThickness(2, 0); // R1 setDefaultBarStyle(PS_DOT, 1); setDefaultBarFgColor(Color.RGB(0,0,255), 1); setDefaultBarThickness(1, 1); // Pivot Point setDefaultBarStyle(PS_SOLID, 2); setDefaultBarFgColor(Color.RGB(251,147,147), 2); setDefaultBarThickness(1, 2); // S1 setDefaultBarStyle(PS_DOT, 3); setDefaultBarFgColor(Color.RGB(0,0,255), 3); setDefaultBarThickness(1, 3); // S2 setDefaultBarStyle(PS_DASH, 4); setDefaultBarFgColor(Color.RGB(255,0,0), 4); setDefaultBarThickness(2, 4); } var bInit = false; var xHigh = null; var xLow = null; var xClose = null; var vPP = null; var vR1 = null; var vS1 = null; var vR2 = null; var vS2 = null; function main() { if(isMonthly() || isWeekly()) return; if(bInit == false){ xHigh = high(inv("D")); xLow = low(inv("D")); xClose = close(inv("D")); bInit = true; } var vHigh = xHigh.getValue(-1); var vLow = xLow.getValue(-1); var vClose = xClose.getValue(-1); if(vHigh == null || vLow == null || vClose == null) return; vPP = (vHigh+vLow+vClose)/3; vR1 = 2*vPP-vLow; vS1 = 2*vPP-vHigh; vR2 = (vPP-vS1)+vR1; vS2 = vPP-(vR1-vS1); return new Array(vR2, vR1, vPP, vS1, vS2); }