I realize pivot questions get asked often, but I haven't found this specific one yet.
What I would like to know is how do I specify a time period other than weekly/monthly? For example, I would like Highest High Value (HHV), Lowest Low Value (LLV) and the close of a specific three year period. So, for example, for the 3 year period ending 31 Dec 2007, I'd like the above.
I'd also like the same idea for the last three quarters, i.e. stop on the quarter ending 30 Sep 2008, and find the HHV, LLV for the previous three quarters inclusive.
Bottom line, I'd like to put in any time period range and get pivots out of that, i.e. last 3 weeks, last 3 months, last 3 days.
I can code it all myself, I just don't know the API/Reference well enough to know how to obtain the HHV/LLV for a specified period.
Here is the old standby completed by another esignal user (thanks by the way).
function main() {
if(isMonthly() || isWeekly())
return;
if(bInit == false){
xHigh = high(inv("H"));
xLow = low(inv("H"));
xClose = close(inv("H"));
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);
}
What I would like to know is how do I specify a time period other than weekly/monthly? For example, I would like Highest High Value (HHV), Lowest Low Value (LLV) and the close of a specific three year period. So, for example, for the 3 year period ending 31 Dec 2007, I'd like the above.
I'd also like the same idea for the last three quarters, i.e. stop on the quarter ending 30 Sep 2008, and find the HHV, LLV for the previous three quarters inclusive.
Bottom line, I'd like to put in any time period range and get pivots out of that, i.e. last 3 weeks, last 3 months, last 3 days.
I can code it all myself, I just don't know the API/Reference well enough to know how to obtain the HHV/LLV for a specified period.
Here is the old standby completed by another esignal user (thanks by the way).
function main() {
if(isMonthly() || isWeekly())
return;
if(bInit == false){
xHigh = high(inv("H"));
xLow = low(inv("H"));
xClose = close(inv("H"));
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);
}
Comment