Hello,
I would like to modify the following efs called "Monthly Pivot Points" (by Alex Montenegro) in a way that it calculates and plots these monthly levels based on the following datapoints:
Highest High of the past 3 months
LowestLow of the past 3 months
and the current months close.
And got no idea how to do that.......
function preMain() {
setPriceStudy(true);
setStudyTitle("Monthly 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(0,0,0), 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(bInit == false){
xHigh = high(inv("M"));
xLow = low(inv("M"));
xClose = close(inv("M"));
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);
}
Anybody can help?
Thanks
I would like to modify the following efs called "Monthly Pivot Points" (by Alex Montenegro) in a way that it calculates and plots these monthly levels based on the following datapoints:
Highest High of the past 3 months
LowestLow of the past 3 months
and the current months close.
And got no idea how to do that.......
function preMain() {
setPriceStudy(true);
setStudyTitle("Monthly 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(0,0,0), 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(bInit == false){
xHigh = high(inv("M"));
xLow = low(inv("M"));
xClose = close(inv("M"));
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);
}
Anybody can help?
Thanks
Comment