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

Re: [amibroker] Can someone explain variables inside and outside of loops



PureBytes Links

Trading Reference Links

Hello,

First - don't use SPACES inside variable names:

Var 3 - wrong

Var3 - OK

And, no, you don't need to repeat calculations, if only you use variable names WITHOUT spaces.

Variable identifiers (names) should start with a LETTER (A-Z, a_z, or underscore)
and can consist of letters and digits. NO spaces or any other characters than a-z, 0-9

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Ken Close" <ken45140@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, May 28, 2008 3:36 PM
Subject: [amibroker] Can someone explain variables inside and outside of loops


> Very basic but I need some confirmation and an explanation why I need to
> repeat calculations inside and outside of loops in order to achieve what I
> need.
> 
> Simplified pseudocode to illustrate my problem
> 
> First:
> -----------------------
> Initialize a set of variables
>  Var 1 = Var2 = 100000;///some quantity
>  Var 1[0] = Var2[0] = 0; initialize
> 
> For loop
>  {
>    Var 3 = Var 1 * Var 2;
>    . . . 
>    Other calculations
>  }
> 
> Filter = 1;
> Addcolumn(Var3, "Var1"); < < < Produces error "Var3 not initialized"
> Etc
> 
> Do this:
> Second:
> -------------------------------
> Initialize a set of variables
>  Var 1 = Var2 = 100000;///some quantity
>  Var 1[0] = Var2[0] = 0; initialize
> 
> For loop
>  {
>    Var 3 = Var 1 * Var 2;
>    . . . 
>    Other calculations
>  }
> 
> Var 3 = Var 1 * Var 2;  < < < Repeat calculation done above inside loop
> solely to be able to execute Addcolumn statement
> 
> Filter = 1;
> Addcolumn(Var3, "Var1"); < < < NO ERROR PRODUCED
> Etc
> 
> All of these are AFL statements, all have been processed in memory.  
> Key question:
> *************************
> Why do I have to repeat the calculation statements outside of the loop in
> order to avoid the "initialize" error?
> *************************
> 
> Basic question, probably dumb.  Yes, I have read the associated help pages
> on this but I do not see the answer to the above if it is there.
> 
> Can someone please educate me on this basic issue.  In some code I have, I
> have a LOT of the calculations that have to be done both inside the loop as
> well as outside and I right now have a significant time penalty as I am
> trying to process 9800 symbols in a single exploration.  I am looking for
> anything I can find to reduce the processing time.
> 
> Thanks,
> 
> Ken
> 
> 
> ------------------------------------
> 
> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> Yahoo! Groups Links
> 
> 
> 

------------------------------------

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/