[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: Syntax-Error



PureBytes Links

Trading Reference Links

Hello,

Enzo wrote: "Whats also a problem for me, the syntax errors are
not only for syntax-checking also for the reasonability of the code,
like, can a index like "i" become a negative number and therefore
being out of range. But it does not explain the syntax error, is it
wrong written or is it the bad logic, which in other programming
languages leads to runtime errors that can only be found out by
debugging (or hard thinking before coding)."

That is not actually the case.

You received SYNTAX ERROR because you have used
() braces instead of {} braces. AmiBroker by default
stops at first (syntax) error.

If your formula was syntactically correct and the only
error was using array subscripts out of range
you would get DIFFERENT error, in this case
"Subscript out of range".

You can easily check by your self, using this code:
for( i = -1; i<BarCount; i++ )
{
  myarray[ i ] = 0;
}

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "enzo" <herrfrechdax@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, October 16, 2004 2:17 PM
Subject: [amibroker] Re: Syntax-Error




Hi Terry,

in IB, Status("firstvisiblebar") returns a number and it can be used
as a base to count backwards or forwards and do operations based on
the bar-number.

Thank you to welcome me in the world of programming :-)) but I
actually have a programming experience of 15 years in Pascal, IDEAL,
FoxPro and VisualBasic. But never coded something thats close to C++

As in AFL brackets are used instead of ENDIF or END IF or ENDLOOP or
LOOP or NEXT it is less readable for me and I have te get used to it
more and more. Whats also a problem for me, the syntax errors are
not only for syntax-checking also for the reasonability of the code,
like, can a index like "i" become a negative number and therefore
being out of range. But it does not explain the syntax error, is it
wrong written or is it the bad logic, which in other programming
languages leads to runtime errors that can only be found out by
debugging (or hard thinking before coding).

So, one of the most useful abilities of AFL is also one of the most
time consuming aspects for a beginner in AFL. Unless there would be
more specific explanations in the Syntax-Error window that pops up.


Regards
enzo

Some days I spent

--- In amibroker@xxxxxxxxxxxxxxx, Terry <MagicTH@xxxx> wrote:
> PS: There also might be a syntax error in your last line where you
test
> against HiBar.
>
> I havenšt figured out how to force Amibroker to use a numeric
variable
> instead of an array variable and I suspect that, although you
think and want
> a numeric variable for HiBar, it might, in fact, be an array
variable...in
> which case you will need HiBar[i];
>
> Just try it and see if your error goes away.
> -- 
> Terry
>
>
> From: Terry <MagicTH@xxxx>
> Reply-To: amibroker@xxxxxxxxxxxxxxx
> Date: Fri, 15 Oct 2004 16:59:47 -0600
> To: <amibroker@xxxxxxxxxxxxxxx>
> Subject: Re: [amibroker] Syntax-Error
>
> > Sorry, but I am almost getting mad.
> Welcome to the world of programming ;-)
>
> > For at least one hour I am trying this and that
> > and all the time I have a syntax error with the
> > following code:
> > (want to determine the number of the bar where the last high
> > occurred before the first visible)
>
> I haven't used this type of code before, but your loop appears to
have an
> error. It should be i < endbar and not i >= endbar
>
> Bars are zero based so the last bar is barcount - 1
>
> I mention this because you may actually want i <= endbar, but I
don't know
> for sure. You can try both ways.
>
> Terry
>
> > per=20;
> > StartBar=Status("firstvisiblebar");
> > EndBar=StartBar-per;
> > HiBar=0;
> > for ( i = startbar; i >= endbar; i-- )
> > (
> >       if (H[i-1]> H[i] AND  H[i-1]>HiBar )
> >             HiBar=i;>
> >
> > )






Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links










------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/