I'm trying to make pivot point in my intraday chart. I have made this far, but something isn't working. can anyone direct my to right direction.
Thanks,
Billy
function preMain() {
setPriceStudy(true);
setStudyTitle("Pivot Range");
setCursorLabelName("Pivot Range");
setCursorLabelName("PR High",0);
setCursorLabelName("PR Low",1);
setDefaultBarStyle(PS_SOLID,0);
setDefaultBarFgColor(Color.black,0);
setDefaultBarThickness(2,0);
setPlotType(PLOTTYPE_FLATLINES,0);
setDefaultBarStyle(PS_SOLID,1);
setDefaultBarFgColor(Color.black,1);
setDefaultBarThickness(2,1);
setPlotType(PLOTTYPE_FLATLINES,1);
}
// initialization flag
var bInit = false;
// global variables for series objects
var xHigh = null;
var xLow = null;
var xClose = null;
function main() {
if (bInit == false) { // initialization routine occurs only once.
Symbol = getSymbol();
Interval = "D";
var vSymbol = Symbol+","+Interval;
xHigh = high(-1,sym(vSymbol));
xLow = low(-1,sym(vSymbol));
xClose = close(-1,sym(vSymbol));
bInit = true;
}
var pHigh = xHigh.getValue(0);
var pLow = xLow.getValue(0);
var pClose= xClose.getValue(0);
pivotRangeDiff = ((pHigh + pLow + pClose) / 3) - ((pHigh + pLow) / 2);
pivotRangeHigh = ((pHigh + pLow + pClose) / 3) + pivotRangeDiff;
pivotRangeLow = ((pHigh + pLow + pClose) / 3) - pivotRangeDiff;
return new Array(pivotRangeHigh,pivotRangeLow);
}
Thanks,
Billy
function preMain() {
setPriceStudy(true);
setStudyTitle("Pivot Range");
setCursorLabelName("Pivot Range");
setCursorLabelName("PR High",0);
setCursorLabelName("PR Low",1);
setDefaultBarStyle(PS_SOLID,0);
setDefaultBarFgColor(Color.black,0);
setDefaultBarThickness(2,0);
setPlotType(PLOTTYPE_FLATLINES,0);
setDefaultBarStyle(PS_SOLID,1);
setDefaultBarFgColor(Color.black,1);
setDefaultBarThickness(2,1);
setPlotType(PLOTTYPE_FLATLINES,1);
}
// initialization flag
var bInit = false;
// global variables for series objects
var xHigh = null;
var xLow = null;
var xClose = null;
function main() {
if (bInit == false) { // initialization routine occurs only once.
Symbol = getSymbol();
Interval = "D";
var vSymbol = Symbol+","+Interval;
xHigh = high(-1,sym(vSymbol));
xLow = low(-1,sym(vSymbol));
xClose = close(-1,sym(vSymbol));
bInit = true;
}
var pHigh = xHigh.getValue(0);
var pLow = xLow.getValue(0);
var pClose= xClose.getValue(0);
pivotRangeDiff = ((pHigh + pLow + pClose) / 3) - ((pHigh + pLow) / 2);
pivotRangeHigh = ((pHigh + pLow + pClose) / 3) + pivotRangeDiff;
pivotRangeLow = ((pHigh + pLow + pClose) / 3) - pivotRangeDiff;
return new Array(pivotRangeHigh,pivotRangeLow);
}
Comment