Hi,
How to get output as series object. whenever i use getSeries it doesn't output anything neither any error.? Please help me out in getting series output. efs code is as below.
Regards
Lucky
How to get output as series object. whenever i use getSeries it doesn't output anything neither any error.? Please help me out in getting series output. efs code is as below.
Regards
Lucky
PHP Code:
var fpArray = new Array;
function preMain() {
setPriceStudy(false);
setStudyTitle("CCI EDIT");
setCursorLabelName("CCI", 0);
setDefaultBarFgColor(Color.RGB(0x00,0x94,0xFF), 0);
setPlotType(PLOTTYPE_LINE,0);
setDefaultBarThickness(1,0);
addBand(100, PS_DASH, 1, Color.grey,"Upper");
addBand(-100, PS_DASH, 1, Color.grey,"Lower");
var x=0;
fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);
with(fpArray[x++])
{
setName("CCI Period 1");
setLowerLimit(1);
setDefault(50);
}
fpArray[x] = new FunctionParameter("CCI1Source", FunctionParameter.STRING);
with(fpArray[x++]){
setName ("CCI 1 Source");
addOption("open");
addOption("high");
addOption("low");
addOption("close");
addOption("hl2");
addOption("oc2");
addOption("hlc3");
addOption("ohlc4");
addOption("hlcc4");
setDefault("close");
}
} //End preMain()
var xPrice = null;
var xAvgPrice = null;
var xCCI = null;
function main(Length, CCI1Source){
if(Length==null) Length = 50;
if(xPrice==null) xPrice = eval(CCI1Source)();
if(xAvgPrice==null) xAvgPrice = sma(Length,xPrice);
if(xPrice.getValue(-Length)==null||xAvgPrice.getValue(-Length)==null) return;
var Sum = 0;
for (i=0; i<Length-1; i++){
Sum += Math.abs(xPrice.getValue(-i)-xAvgPrice.getValue(0));
}
//if(Length != 0){
var MeanDevPrice = Sum/Length;
var CCI = (xPrice.getValue(0)-xAvgPrice.getValue(0))/(MeanDevPrice*0.015);
//xCCI = getSeries(CCI);
//var CCI = getSeries((xPrice.getValue(0)-xAvgPrice.getValue(0))/(MeanDevPrice*0.015));
// } else CCI =0 ;
return CCI;
//return getValue.CCI(-2);
}?
Comment