Setting length on the BuiltIn CCI indicator to a number > 1000
I get an error " line 40 parameter 1 invalid ". Why ?
I get an error " line 40 parameter 1 invalid ". Why ?
var fpArray = new Array();
function preMain() {
setPriceStudy(false);
setStudyTitle("CCI");
setCursorLabelName("CCI", 0);
setDefaultBarFgColor(Color.blue, 0);
setPlotType(PLOTTYPE_LINE,0);
setDefaultBarThickness(1,0);
askForInput();
var x=0;
fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(20);
}
fpArray[x] = new FunctionParameter("Source", FunctionParameter.STRING);
with(fpArray[x++]){
addOption("open");
addOption("high");
addOption("low");
addOption("close");
addOption("hl2");
addOption("hlc3");
addOption("ohlc4");
setDefault("close");
}
fpArray[x] = new FunctionParameter("Symbol", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault();
}
fpArray[x] = new FunctionParameter("Interval", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault();
}
fpArray[x] = new FunctionParameter("Upper", FunctionParameter.NUMBER);
with(fpArray[x++]){
setDefault(100);
}
fpArray[x] = new FunctionParameter("Lower", FunctionParameter.NUMBER);
with(fpArray[x++]){
setDefault(-100);
}
fpArray[x] = new FunctionParameter("Params", FunctionParameter.BOOLEAN);
with(fpArray[x++]){
setName("Show Parameters");
setDefault(false);
}
}
var bInit = false;
var xCCI = null;
var vLastAlert = null;
function main(Length,Source,Symbol,Interval,Upper,Lower,Params) {
if(bInit == false){
if(Symbol == null) Symbol = getSymbol();
if(Interval == null) Interval = getInterval();
var vSymbol = Symbol+","+Interval;
xCCI = cci(Length, eval(Source)(sym(vSymbol)));
if(xCCI < -100 && vLastAlert != -1){
Alert.addToList(getSymbol(), "CCI is < -100", Color.white, Color.blue);
Alert.playSound("beep.wav");
vLastAlert = -1;
}
if(xCCI > 100 && vLastAlert != 1){
Alert.addToList(getSymbol(), "CCI is > 100", Color.white, Color.blue);
Alert.playSound("beep.wav");
vLastAlert = 1;
}
addBand( Upper, PS_SOLID, 1, Color.black,"Upper");
addBand( Lower, PS_SOLID, 1, Color.black,"Lower");
setShowTitleParameters(eval(Params));
bInit = true;
}
return getSeries(xCCI);
}
var fpArray = new Array();
function preMain() {
setPriceStudy(false);
setStudyTitle("CCI");
setCursorLabelName("CCI", 0);
setDefaultBarFgColor(Color.blue, 0);
setPlotType(PLOTTYPE_LINE,0);
setDefaultBarThickness(1,0);
askForInput();
var x=0;
fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(20);
}
fpArray[x] = new FunctionParameter("Source", FunctionParameter.STRING);
with(fpArray[x++]){
addOption("open");
addOption("high");
addOption("low");
addOption("close");
addOption("hl2");
addOption("hlc3");
addOption("ohlc4");
setDefault("close");
}
fpArray[x] = new FunctionParameter("Symbol", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault();
}
fpArray[x] = new FunctionParameter("Interval", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault();
}
fpArray[x] = new FunctionParameter("Upper", FunctionParameter.NUMBER);
with(fpArray[x++]){
setDefault(100);
}
fpArray[x] = new FunctionParameter("Lower", FunctionParameter.NUMBER);
with(fpArray[x++]){
setDefault(-100);
}
fpArray[x] = new FunctionParameter("Params", FunctionParameter.BOOLEAN);
with(fpArray[x++]){
setName("Show Parameters");
setDefault(false);
}
}
var bInit = false;
var xCCI = null;
var vLastAlert = null;
function main(Length,Source,Symbol,Interval,Upper,Lower,Params) {
if(bInit == false){
if(Symbol == null) Symbol = getSymbol();
if(Interval == null) Interval = getInterval();
var vSymbol = Symbol+","+Interval;
xCCI = cci(Length, eval(Source)(sym(vSymbol)));
if(xCCI < -100 && vLastAlert != -1){
Alert.addToList(getSymbol(), "CCI is < -100", Color.white, Color.blue);
Alert.playSound("beep.wav");
vLastAlert = -1;
}
if(xCCI > 100 && vLastAlert != 1){
Alert.addToList(getSymbol(), "CCI is > 100", Color.white, Color.blue);
Alert.playSound("beep.wav");
vLastAlert = 1;
}
addBand( Upper, PS_SOLID, 1, Color.black,"Upper");
addBand( Lower, PS_SOLID, 1, Color.black,"Lower");
setShowTitleParameters(eval(Params));
bInit = true;
}
return getSeries(xCCI);
}
var fpArray = new Array();
function preMain() {
setPriceStudy(false);
setStudyTitle("CCI");
setCursorLabelName("CCI", 0);
setDefaultBarFgColor(Color.blue, 0);
setPlotType(PLOTTYPE_LINE,0);
setDefaultBarThickness(1,0);
askForInput();
var x=0;
fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(27);
}
fpArray[x] = new FunctionParameter("Source", FunctionParameter.STRING);
with(fpArray[x++]){
addOption("open");
addOption("high");
addOption("low");
addOption("close");
addOption("hl2");
addOption("hlc3");
addOption("ohlc4");
setDefault("hlc3");
}
fpArray[x] = new FunctionParameter("Symbol", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault();
}
fpArray[x] = new FunctionParameter("Interval", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault();
}
fpArray[x] = new FunctionParameter("Upper", FunctionParameter.NUMBER);
with(fpArray[x++]){
setDefault(100);
}
fpArray[x] = new FunctionParameter("Lower", FunctionParameter.NUMBER);
with(fpArray[x++]){
setDefault(-100);
}
fpArray[x] = new FunctionParameter("Params", FunctionParameter.BOOLEAN);
with(fpArray[x++]){
setName("Show Parameters");
setDefault(false);
}
}
var bInit = false;
var xCCI = null;
//var vLastAlert = null;
function main(Length,Source,Symbol,Interval,Interval2,Upper,Lower,Params) {
if(bInit == false){
if(Symbol == null) Symbol = getSymbol();
if(Interval == null) Interval = getInterval();
var vSymbol = Symbol+","+Interval;
xCCI = cci(Length, eval(Source)(sym(vSymbol)));
addBand( Upper, PS_SOLID, 1, Color.black,"Upper");
addBand( Lower, PS_SOLID, 1, Color.black,"Lower");
setShowTitleParameters(eval(Params));
bInit = true;
}
var nCCI = xCCI.getValue();
if(nCCI < -0){
Alert.addToList(getSymbol(), "CCI is < -100", Color.white, Color.blue);
Alert.playSound("beep.wav");
//vLastAlert = -1;
}
if(nCCI >= 0){
Alert.addToList(getSymbol(), "CCI is > 100", Color.white, Color.blue);
Alert.playSound("ding.wav");
// vLastAlert = 1;
}
return getSeries(xCCI);
}
var fpArray = new Array();
function preMain() {
setPriceStudy(false);
setStudyTitle("CCI");
setCursorLabelName("CCI", 0);
setDefaultBarFgColor(Color.blue, 0);
setPlotType(PLOTTYPE_LINE,0);
setDefaultBarThickness(1,0);
askForInput();
var x=0;
fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(27);
}
fpArray[x] = new FunctionParameter("Source", FunctionParameter.STRING);
with(fpArray[x++]){
addOption("open");
addOption("high");
addOption("low");
addOption("close");
addOption("hl2");
addOption("hlc3");
addOption("ohlc4");
setDefault("hlc3");
}
fpArray[x] = new FunctionParameter("Symbol", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault();
}
fpArray[x] = new FunctionParameter("Interval", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault();
}
fpArray[x] = new FunctionParameter("Upper", FunctionParameter.NUMBER);
with(fpArray[x++]){
setDefault(100);
}
fpArray[x] = new FunctionParameter("Lower", FunctionParameter.NUMBER);
with(fpArray[x++]){
setDefault(-100);
}
fpArray[x] = new FunctionParameter("Params", FunctionParameter.BOOLEAN);
with(fpArray[x++]){
setName("Show Parameters");
setDefault(false);
}
}
var bInit = false;
var xCCI = null;
//var vLastAlert = null;
function main(Length,Source,Symbol,Interval,Interval2,Upper,Lower,Params) {
if(bInit == false){
if(Symbol == null) Symbol = getSymbol();
if(Interval == null) Interval = getInterval();
var vSymbol = Symbol+","+Interval;
xCCI = cci(Length, eval(Source)(sym(vSymbol)));
addBand( Upper, PS_SOLID, 1, Color.black,"Upper");
addBand( Lower, PS_SOLID, 1, Color.black,"Lower");
setShowTitleParameters(eval(Params));
bInit = true;
}
var nCCI = xCCI.getValue();
if(nCCI < -0){
Alert.addToList(getSymbol(), "CCI is < -100", Color.white, Color.blue);
Alert.playSound("beep.wav");
//vLastAlert = -1;
}
if(nCCI >= 0){
Alert.addToList(getSymbol(), "CCI is > 100", Color.white, Color.blue);
Alert.playSound("ding.wav");
// vLastAlert = 1;
}
return getSeries(xCCI);
}
Comment