Declinations Script Error

Have a QScript to share, or need help with programming? Post your comment here.
Post Reply
Mark
Posts: 18
Joined: Wed Mar 18, 2020 7:37 pm
Contact:

Declinations Script Error

Post by Mark » Thu Dec 30, 2021 3:50 pm

I'm getting two errors in each:
I've retyped an half dozen time still error.

On the Indicator, I'm getting an error on line 8 "declinatiosystem" unknown function and illegal math expression.

input:ahead(60),color(blue),thickness(1),show_midline(true),
show_middots(true),midptcolor(red),midstyles(ps_dot),
midline_thick(1);
if(barnum==barsback){
lastlo,lasthi=-1;
lastmidbar=-1;lastmidprice=0;
}
df=DeclinationSystem(ahead);
plot1[-ahead]=df;
color1[-ahead]=color;
thickness1[-ahead]=thickness;
if((df[1]<df[2])and(df[1]<df)){
lastlo=barnum-1;
loval=df[1];
if(lasthi>0){
back=(lastlo-lasthi)*0.5;
offset=barnum_to_offset(barnum-(back+1)+ahead);
if(show_middots==true)plot_dot(barnum-
(back+1)+ahead,df[offset+ahead],color,3+thickness);
if((show_midline==true)and(lastmidbar!=-1)){
ref1=trendline(lastmidbar,lastmidprice,barnum-
(back+1)+ahead,df[offset+ahead],midpcolor);
set_tl_style(ref1,midstyle);
set_tl-size(ref1,midline_thick);
}
lastmidbar=barnum-(back+1)+ahead;
lastmidprice=df[offset+ahead];
}
}
if((df[1]>df[2])and(df[1]>df)){
lasthi=barnum-1;
hival=df[1];
if(lastlo>0){
back=(lasthi-lastlo)*0.5;
offset=barnum_to_offset(barnum-(back+1)+ahead);
if(show_middots==true)plot_dot(barnum-
(back+1)+ahead,df[offset+ahead],color,3+thickness);
if((show_midline==true)and(lastmidbar!=-1)){
ref1=trendline(lastmidbar,lastmidprice,barnum-
(back+1)+ahead,df[offset+ahead],midptcolor);
set_tl_style(ref1,midstyle);
set_tl_size(ref1,midline_thick);
}
lastmidbar=barnum-(back+1)+ahead;
lastmidprice=df[offset+ahead];
}
}


On the Function. I'm getting:
Too few parameters in astro_declination Line 8 also illegal math expression.

input:ahead;
merc=astro_declination(year[-ahead],month[-ahead],
day[-ahead],time[-ahead],astro_mercury,false);
ven=astro_declination(year[-ahead],month[-ahead],
day[-ahead],time[-ahead],astro_venus,false);
sun=astro_declination(year[-ahead],month[-ahead],
day[-ahead],time[-ahead],astro_sun,false);
mars=astro_declination(year[-ahead],month[-ahead],
day[-ahead],time[-ahead]astro_mars,false);
jupiter=astro_declination(year[-ahead],month[-ahead],
day[-ahead],time[-ahead],astro_jupiter,false);
saturn=astro_declination(year[-ahead],month[-ahead],
day[-ahead],time[-ahead],astro_saturn,false);
total=merc*6+ven*5+sun*4+mars*3+jupiter*2+saturn;
return total;

Thanks for looking
Mark

sbank
Posts: 117
Joined: Tue Jul 21, 2015 9:35 pm
Contact:

Re: Declinations Script Error

Post by sbank » Wed Jan 05, 2022 2:13 pm

Looking at this now. I noticed in your function on the mars line, you are missing a comma. That is the cause of the invalid number of arguments error.

Looking at the indicator now...

sbank
Posts: 117
Joined: Tue Jul 21, 2015 9:35 pm
Contact:

Re: Declinations Script Error

Post by sbank » Wed Jan 05, 2022 2:26 pm

Looked at the indicator. Didn't test it. But was able to make it compile. You mainly just had minor typos in the code. Here is the cleaned up version:

Code: Select all

input:ahead(60),color(blue),thickness(1),show_midline(true),show_middots(true),midptcolor(red),midstyle(ps_dot),midline_thick(1);

if (barnum==barsback){
  lastlo,lasthi=-1;  
  lastmidbar=-1;lastmidprice=0;
}

df=DeclinationSystem(ahead);

plot1[-ahead]=df;                                                
color1[-ahead]=color;      
thickness1[-ahead]=thickness;

if((df[1]<df[2])and(df[1]<df)){
  lastlo=barnum-1;
  loval=df[1];
  if(lasthi>0){
    back=(lastlo-lasthi)*0.5;
    offset=barnum_to_offset(barnum-(back+1)+ahead);
    if(show_middots==true) {
      plot_dot(barnum-(back+1)+ahead,df[offset+ahead],color,3+thickness);
    }  
   
    if((show_midline==true)and(lastmidbar!=-1)){
      ref1=trendline(lastmidbar,lastmidprice,barnum-(back+1)+ahead,df[offset+ahead],midptcolor);  
      set_tl_style(ref1,midstyle);                       
      set_tl_size(ref1,midline_thick);
    }    
    lastmidbar=barnum-(back+1)+ahead; 
    lastmidprice=df[offset+ahead];
  }  
}

if((df[1]>df[2])and(df[1]>df)){
  lasthi=barnum-1;
  hival=df[1];
  if(lastlo>0){
    back=(lasthi-lastlo)*0.5;
    offset=barnum_to_offset(barnum-(back+1)+ahead);
    
    if(show_middots==true)plot_dot(barnum-(back+1)+ahead,df[offset+ahead],color,3+thickness);
  
    if((show_midline==true)and(lastmidbar!=-1)){
      ref1=trendline(lastmidbar,lastmidprice,barnum-(back+1)+ahead,df[offset+ahead],midptcolor);
      set_tl_style(ref1,midstyle);                                                             
      set_tl_size(ref1,midline_thick);
    }  
    lastmidbar=barnum-(back+1)+ahead;
    lastmidprice=df[offset+ahead];
  }  
}

Mark
Posts: 18
Joined: Wed Mar 18, 2020 7:37 pm
Contact:

Re: Declinations Script Error

Post by Mark » Thu Jan 20, 2022 3:52 pm

Thanks, that one comma corrected it.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest