How can I add R3/S3 and R4/S4 to the pivots? I am currently using this PivotPointsAll.efs file for my daily pivots:
/************************************************** **************************************************
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", 1);
setCursorLabelName("PP", 2);
setCursorLabelName("PP-S1", 3);
setCursorLabelName("PP-S2", 4);
// R2
setDefaultBarStyle(PS_DASH, 0);
setDefaultBarFgColor(Color.RGB(204,204,0), 0);
setDefaultBarThickness(1, 0);
// R1
setDefaultBarStyle(PS_DASH, 1);
setDefaultBarFgColor(Color.RGB(0,128,255), 1);
setDefaultBarThickness(1, 1);
// Pivot Point
setDefaultBarStyle(PS_DASH, 2);
setDefaultBarFgColor(Color.RGB(128,128,128), 2);
setDefaultBarThickness(1, 2);
// S1
setDefaultBarStyle(PS_DASH, 3);
setDefaultBarFgColor(Color.RGB(0,255,0), 3);
setDefaultBarThickness(1, 3);
// S2
setDefaultBarStyle(PS_DASH, 4);
setDefaultBarFgColor(Color.RGB(204,204,0), 4);
setDefaultBarThickness(1, 4);
}
// 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 = 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;
vLastArray = new Array(vLastPPR2, vLastPPR1, vLastPP, vLastPPS1, vLastPPS2);
return vLastArray;
}
}
}
return null;
}/************************************************** **************************************************
/************************************************** **************************************************
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", 1);
setCursorLabelName("PP", 2);
setCursorLabelName("PP-S1", 3);
setCursorLabelName("PP-S2", 4);
// R2
setDefaultBarStyle(PS_DASH, 0);
setDefaultBarFgColor(Color.RGB(204,204,0), 0);
setDefaultBarThickness(1, 0);
// R1
setDefaultBarStyle(PS_DASH, 1);
setDefaultBarFgColor(Color.RGB(0,128,255), 1);
setDefaultBarThickness(1, 1);
// Pivot Point
setDefaultBarStyle(PS_DASH, 2);
setDefaultBarFgColor(Color.RGB(128,128,128), 2);
setDefaultBarThickness(1, 2);
// S1
setDefaultBarStyle(PS_DASH, 3);
setDefaultBarFgColor(Color.RGB(0,255,0), 3);
setDefaultBarThickness(1, 3);
// S2
setDefaultBarStyle(PS_DASH, 4);
setDefaultBarFgColor(Color.RGB(204,204,0), 4);
setDefaultBarThickness(1, 4);
}
// 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 = 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;
vLastArray = new Array(vLastPPR2, vLastPPR1, vLastPP, vLastPPS1, vLastPPS2);
return vLastArray;
}
}
}
return null;
}/************************************************** **************************************************
Comment