I'm trying to use "continue label" statement in my script, but when I apply study on chart I have a syntax error at line 36.
I can't find the error.
Please, someone more expert than me, can help me?
Thanks in advance.
Massimo
var vEx=null;
function main() {
debugPrintln("Start ");
if (vEx==null) vEx=Pivot(high(), 20, 3, 3, 1, 1);
debugPrintln("Prova "+vEx.getValue(0));
}
// PIVOT Function ------------------------------------------------------------------------
var bPivot_Init=false;
function Pivot(xPriceValue, xLen, xLeftStrength, xRightStrength, xInstance, xHiLo) {
if (bPivot_Init==false) {
var vPriceValue=xPriceValue;
var vLen=-xLen;
var vLeftStrength=-xLeftStrength;
var vRightStrength=-xRightStrength;
var vInstance=xInstance;
var vHiLo=xHiLo;
var vCount_Instance=0;
var vX=0;
var vY=0;
var bPivot_Flag=false;
var vReturnPivot=-1, vReturnPivotPriceValue=-1, vReturnPivotBar=-1;
var vCounter=0;
bPivot_Init=true;
}
vX=vRightStrength; //Our first bar index
maxlabel1 :
while (bPivot_Flag==false && vX>vLen) { //we start scanning bars
debugPrintln("Counter "+vCounter++);
vY=vX+1; //Index of the bar to compare with
while ((vX-vY)>=vRightStrength) { // check dx
if ((vHiLo==1 && vPriceValue.getValue(vX)>vPriceValue.getValue(vY)) || (vHiLo==-1 && vPriceValue.getValue(vX)<vPriceValue.getValue(vY)) ) {
vY=vY+1;
} else { // dx check ko
vX=vX-1;
continue maxlabel1;
}
}
vY=vX-1; // dx ok, now sx
while ((vY-vX)>=vLeftStrength) { // check sx
if ((vHiLo==1 && vPriceValue.getValue(vX)>=vPriceValue.getValue(vY) ) || (vHiLo==-1 && vPriceValue.getValue(vX)<=vPriceValue.getValue(vY) )) {
vY--;
} else { // sx check ko
vX--;
continue maxlabel1;
}
}
vCount_Instance++; // here pivot ok & vCount_Instance++
if (vCount_Instance==Instance) {
bPivot_Flag=true;
} else { // go to next vCount_Instance
vX--;
continue maxlabel1;
}
}
if (bPivot_Flag==true) {
vReturnPivot=1;
vReturnPivotPriceValue=vPriceValue.getValue(vX);
vReturnPivotBar=vX;
drawImageRelative(vReturnPivotBar, vReturnPivotPriceValue, "SystemHappyFace", null, Image.ONTOP, "TagName");
} else {
vReturnPivot=-1;
vReturnPivotPriceValue=-1;
vReturnPivotBar=-1;
}
return new Array (vReturnPivot, vReturnPivotPriceValue, vReturnPivotBar);
}
I can't find the error.
Please, someone more expert than me, can help me?
Thanks in advance.
Massimo
var vEx=null;
function main() {
debugPrintln("Start ");
if (vEx==null) vEx=Pivot(high(), 20, 3, 3, 1, 1);
debugPrintln("Prova "+vEx.getValue(0));
}
// PIVOT Function ------------------------------------------------------------------------
var bPivot_Init=false;
function Pivot(xPriceValue, xLen, xLeftStrength, xRightStrength, xInstance, xHiLo) {
if (bPivot_Init==false) {
var vPriceValue=xPriceValue;
var vLen=-xLen;
var vLeftStrength=-xLeftStrength;
var vRightStrength=-xRightStrength;
var vInstance=xInstance;
var vHiLo=xHiLo;
var vCount_Instance=0;
var vX=0;
var vY=0;
var bPivot_Flag=false;
var vReturnPivot=-1, vReturnPivotPriceValue=-1, vReturnPivotBar=-1;
var vCounter=0;
bPivot_Init=true;
}
vX=vRightStrength; //Our first bar index
maxlabel1 :
while (bPivot_Flag==false && vX>vLen) { //we start scanning bars
debugPrintln("Counter "+vCounter++);
vY=vX+1; //Index of the bar to compare with
while ((vX-vY)>=vRightStrength) { // check dx
if ((vHiLo==1 && vPriceValue.getValue(vX)>vPriceValue.getValue(vY)) || (vHiLo==-1 && vPriceValue.getValue(vX)<vPriceValue.getValue(vY)) ) {
vY=vY+1;
} else { // dx check ko
vX=vX-1;
continue maxlabel1;
}
}
vY=vX-1; // dx ok, now sx
while ((vY-vX)>=vLeftStrength) { // check sx
if ((vHiLo==1 && vPriceValue.getValue(vX)>=vPriceValue.getValue(vY) ) || (vHiLo==-1 && vPriceValue.getValue(vX)<=vPriceValue.getValue(vY) )) {
vY--;
} else { // sx check ko
vX--;
continue maxlabel1;
}
}
vCount_Instance++; // here pivot ok & vCount_Instance++
if (vCount_Instance==Instance) {
bPivot_Flag=true;
} else { // go to next vCount_Instance
vX--;
continue maxlabel1;
}
}
if (bPivot_Flag==true) {
vReturnPivot=1;
vReturnPivotPriceValue=vPriceValue.getValue(vX);
vReturnPivotBar=vX;
drawImageRelative(vReturnPivotBar, vReturnPivotPriceValue, "SystemHappyFace", null, Image.ONTOP, "TagName");
} else {
vReturnPivot=-1;
vReturnPivotPriceValue=-1;
vReturnPivotBar=-1;
}
return new Array (vReturnPivot, vReturnPivotPriceValue, vReturnPivotBar);
}
Comment