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

Re: [amibroker] Addition assignment



PureBytes Links

Trading Reference Links

Thanks Graham,

I got the example from pressing F1 and searching for 'mathematical 
operators' - cut of text below.
It's no big deal and maybe I misunderstood the section. Using ExitRate = 
ExitRate + Point;  worked for me anyway but I just wondered.


======snip=============================================
Compound statements (Blocks)
A compound statement consists of zero or more statements enclosed in 
curly braces ({ }). A compound statement can be used anywhere a 
statement is expected. Compound statements are commonly called “blocks.”

{
statement1;
....
statementN;
}

(this is 'borrowed' from C language, users of other programming 
languages are used to use BEGIN for { and END for } )

if( Amount > 100 )
{
    _TRACE("Amount above 100");
     Balance += Amount;
}
else
     Balance -= Amount;
=======================================================
Cheers
Martin

Graham wrote:
> you are trying to add something to itself ?
> No such thing as addition assignment +=, at least that I am aware of
> If you need to use the previous bar value to calculate the current
> value then you need to use either loop or cum function
> 
> Point = WhateverCalculation;
> Exitrate = cum(point);
> 
> if more complex then for loop is needed
> assuming point array is already calculated somewhere before this
> Point = WhateverCalculation;
> Exitrate[0] = Point[0];
> for(i=1;i<barcount;i++)
> {
>   ExitRate[i] = ExitRate[i-1] + Point[i];
> }
> 
> this allows you to do more complex calcs than just his example
> 
> --
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm
> 
> 
> On 12/8/05, Martin Cooney <martin@xxxxxxxxxxxxx> wrote:
>  > Hi,
>  >
>  > Newbie at this but I'd been trying to use an addition assignment but get
>  > a syntax error 30
>  >
>  > e.g.
>  > ExitRate += Point;
>  >
>  > When I replace it with
>  > ExitRate = ExitRate + Point;
>  > I get no error. I've seen an example of it's use in the manua; and
>  > wondered what minor silly thing I'm doing wrong is? Anyone ?
>  >
>  > Cheers
>  > Martin
> 
> 
> Please note that this group is for discussion between users only.
> 
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> 
> 
> 
> 
> ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
> 
>     *  Visit your group "amibroker
>       <http://groups.yahoo.com/group/amibroker>" on the web.
>        
>     *  To unsubscribe from this group, send an email to:
>        amibroker-unsubscribe@xxxxxxxxxxxxxxx
>       <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
>        
>     *  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
> 
> 
> ------------------------------------------------------------------------
> 


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.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/