var parms=new Array();
var WMA1=new Array();
var WMA2=new Array();
var WMA3=new Array();
var WMA4=new Array();
var WMA5=new Array();
var WMA6=new Array();
var ERGA=new Array();
var barcounter=0;
var weightx1=0;
var weightx2=0;
var weightx1a=new Array();
var weightx2a=new Array();
var weightx3a=new Array();
function preMain(){
var x=0;
setPriceStudy(false);
setStudyTitle("WERG");
setCursorLabelName("WERG",0);
setCursorLabelName("Upper Band",1);
setCursorLabelName("Zero Band",2);
setCursorLabelName("Lower Band",3);
setShowTitleParameters(false);
parms[x]=new FunctionParameter("x1",FunctionParameter.NUMBER);
with(parms[x]){setName("1st MA");setDefault(7);}
x++;
parms[x]=new FunctionParameter("x2",FunctionParameter.NUMBER);
with(parms[x]){setName("2nd MA");setDefault(28);}
x++;
parms[x]=new FunctionParameter("x3",FunctionParameter.NUMBER);
with(parms[x]){setName("3rd MA");setDefault(7);}
x++;
parms[x]=new FunctionParameter("linecolorlong",FunctionParamete r.COLOR);
with(parms[x]){setName("Line Color Long");setDefault(Color.blue);}
x++;
parms[x]=new FunctionParameter("linecolorshort",FunctionParamet er.COLOR);
with(parms[x]){setName("Line Color Short");setDefault(Color.red);}
x++;
parms[x]=new FunctionParameter("linethickness",FunctionParamete r.NUMBER);
with(parms[x]){setName("Line Thickness");setDefault(2);}
x++;
parms[x]=new FunctionParameter("colorbars",FunctionParameter.ST RING);
with(parms[x]){setName("Color Price Bars?");addOption("Yes");addOption("No");setDefaul t("No");}
x++;
parms[x]=new FunctionParameter("bandsize",FunctionParameter.NUM BER);
with(parms[x]){setName("Band Size");setDefault(50);}
x++;
parms[x]=new FunctionParameter("bandcolor",FunctionParameter.CO LOR);
with(parms[x]){setName("Band Color");setDefault(Color.black);}
x++;
parms[x]=new FunctionParameter("bandthickness",FunctionParamete r.NUMBER);
with(parms[x]){setName( "Band Thickness" );setDefault( 2 );}
}
function main(x1,x2,x3,linecolorlong,linecolorshort,linethi ckness,colorbars,bandsize,bandcolor,bandthickness)
{
var sum1=0;
var sum4=0;
var sum2=0;
var sum3=0;
var sum5=0;
var sum6=0;
var mx=Math.max(x1,x2,x3)*2;
setBarFgColor(bandcolor,1);
setBarFgColor(bandcolor,2);
setBarFgColor(bandcolor,3);
setBarThickness(linethickness,0);
setBarThickness(bandthickness,1);
setBarThickness(bandthickness,2);
setBarThickness(bandthickness,3);
if(colorbars=="Yes"){setColorPriceBars(true);}
if(barcounter==0){
var i;
for(i=0;i
weightx1+=(x1-i); <---- LINE 78
weightx1a[i]=(x1-i);
}
for(i=0;i
weightx2+=(x2-i);
weightx2a[i]=(x2-i);
}
for(i=0;i
weightx3a[i]=(x3-i);
}
}
if(getBarState()==BARSTATE_ALLBARS){return;}
if(getBarState()==BARSTATE_NEWBAR){
barcounter++;
WMA1.unshift(0);
WMA2.unshift(0);
WMA3.unshift(0);
WMA4.unshift(0);
WMA5.unshift(0);
WMA6.unshift(0);
ERGA.unshift(0);
}
if (barcounter == 0) {
WMA1[0]=0;
WMA4[0]=0;
}
else {
WMA1[0]=(close(0)-close(-1));
WMA4[0]=Math.abs(close(0)-close(-1));
}
if(barcounter<=mx){return;}
for(i=0;i
sum1+=WMA1[i]*weightx1a[i];
sum4+=WMA4[i]*weightx1a[i];
}
WMA2[0]=(sum1/weightx1);
WMA5[0]=(sum4/weightx1);
for(i=0;i
sum2+=WMA2[i]*weightx2a[i];
sum5+=WMA5[i]*weightx2a[i];
}
WMA3[0]=(sum2/weightx2);
WMA6[0]=(sum5/weightx2);
for(i=0;i
sum3+=WMA3[i]*weightx3a[i];
sum6+=WMA6[i]*weightx3a[i];
}
ERGA[0]=(sum3/sum6)*100;
if((ERGA[0]-ERGA[1])>0){
setBarFgColor(linecolorlong,0);
if(colorbars=="Yes"){setPriceBarColor(linecolorlon g)};
}
else{
setBarFgColor(linecolorshort,0);
if(colorbars=="Yes"){setPriceBarColor(linecolorsho rt)};
}
if(getBarState()==BARSTATE_NEWBAR&&barcounter>mx){
WMA1.pop();
WMA2.pop();
WMA3.pop();
WMA4.pop();
WMA5.pop();
WMA6.pop();
ERGA.pop();
}
return new Array(ERGA[0],bandsize,0,-bandsize);
}
Hi, says it has an error as follows:
Advanced\ErgodicAGmarket.efs, line 78:
SyntaxError: missing ; after for-loop condition: weightx1+=(x1-i);
^
Thanks for the help !
var WMA1=new Array();
var WMA2=new Array();
var WMA3=new Array();
var WMA4=new Array();
var WMA5=new Array();
var WMA6=new Array();
var ERGA=new Array();
var barcounter=0;
var weightx1=0;
var weightx2=0;
var weightx1a=new Array();
var weightx2a=new Array();
var weightx3a=new Array();
function preMain(){
var x=0;
setPriceStudy(false);
setStudyTitle("WERG");
setCursorLabelName("WERG",0);
setCursorLabelName("Upper Band",1);
setCursorLabelName("Zero Band",2);
setCursorLabelName("Lower Band",3);
setShowTitleParameters(false);
parms[x]=new FunctionParameter("x1",FunctionParameter.NUMBER);
with(parms[x]){setName("1st MA");setDefault(7);}
x++;
parms[x]=new FunctionParameter("x2",FunctionParameter.NUMBER);
with(parms[x]){setName("2nd MA");setDefault(28);}
x++;
parms[x]=new FunctionParameter("x3",FunctionParameter.NUMBER);
with(parms[x]){setName("3rd MA");setDefault(7);}
x++;
parms[x]=new FunctionParameter("linecolorlong",FunctionParamete r.COLOR);
with(parms[x]){setName("Line Color Long");setDefault(Color.blue);}
x++;
parms[x]=new FunctionParameter("linecolorshort",FunctionParamet er.COLOR);
with(parms[x]){setName("Line Color Short");setDefault(Color.red);}
x++;
parms[x]=new FunctionParameter("linethickness",FunctionParamete r.NUMBER);
with(parms[x]){setName("Line Thickness");setDefault(2);}
x++;
parms[x]=new FunctionParameter("colorbars",FunctionParameter.ST RING);
with(parms[x]){setName("Color Price Bars?");addOption("Yes");addOption("No");setDefaul t("No");}
x++;
parms[x]=new FunctionParameter("bandsize",FunctionParameter.NUM BER);
with(parms[x]){setName("Band Size");setDefault(50);}
x++;
parms[x]=new FunctionParameter("bandcolor",FunctionParameter.CO LOR);
with(parms[x]){setName("Band Color");setDefault(Color.black);}
x++;
parms[x]=new FunctionParameter("bandthickness",FunctionParamete r.NUMBER);
with(parms[x]){setName( "Band Thickness" );setDefault( 2 );}
}
function main(x1,x2,x3,linecolorlong,linecolorshort,linethi ckness,colorbars,bandsize,bandcolor,bandthickness)
{
var sum1=0;
var sum4=0;
var sum2=0;
var sum3=0;
var sum5=0;
var sum6=0;
var mx=Math.max(x1,x2,x3)*2;
setBarFgColor(bandcolor,1);
setBarFgColor(bandcolor,2);
setBarFgColor(bandcolor,3);
setBarThickness(linethickness,0);
setBarThickness(bandthickness,1);
setBarThickness(bandthickness,2);
setBarThickness(bandthickness,3);
if(colorbars=="Yes"){setColorPriceBars(true);}
if(barcounter==0){
var i;
for(i=0;i
weightx1+=(x1-i); <---- LINE 78
weightx1a[i]=(x1-i);
}
for(i=0;i
weightx2+=(x2-i);
weightx2a[i]=(x2-i);
}
for(i=0;i
weightx3a[i]=(x3-i);
}
}
if(getBarState()==BARSTATE_ALLBARS){return;}
if(getBarState()==BARSTATE_NEWBAR){
barcounter++;
WMA1.unshift(0);
WMA2.unshift(0);
WMA3.unshift(0);
WMA4.unshift(0);
WMA5.unshift(0);
WMA6.unshift(0);
ERGA.unshift(0);
}
if (barcounter == 0) {
WMA1[0]=0;
WMA4[0]=0;
}
else {
WMA1[0]=(close(0)-close(-1));
WMA4[0]=Math.abs(close(0)-close(-1));
}
if(barcounter<=mx){return;}
for(i=0;i
sum1+=WMA1[i]*weightx1a[i];
sum4+=WMA4[i]*weightx1a[i];
}
WMA2[0]=(sum1/weightx1);
WMA5[0]=(sum4/weightx1);
for(i=0;i
sum2+=WMA2[i]*weightx2a[i];
sum5+=WMA5[i]*weightx2a[i];
}
WMA3[0]=(sum2/weightx2);
WMA6[0]=(sum5/weightx2);
for(i=0;i
sum3+=WMA3[i]*weightx3a[i];
sum6+=WMA6[i]*weightx3a[i];
}
ERGA[0]=(sum3/sum6)*100;
if((ERGA[0]-ERGA[1])>0){
setBarFgColor(linecolorlong,0);
if(colorbars=="Yes"){setPriceBarColor(linecolorlon g)};
}
else{
setBarFgColor(linecolorshort,0);
if(colorbars=="Yes"){setPriceBarColor(linecolorsho rt)};
}
if(getBarState()==BARSTATE_NEWBAR&&barcounter>mx){
WMA1.pop();
WMA2.pop();
WMA3.pop();
WMA4.pop();
WMA5.pop();
WMA6.pop();
ERGA.pop();
}
return new Array(ERGA[0],bandsize,0,-bandsize);
}
Hi, says it has an error as follows:
Advanced\ErgodicAGmarket.efs, line 78:
SyntaxError: missing ; after for-loop condition: weightx1+=(x1-i);
^
Thanks for the help !
Comment