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

[amibroker] Exploration - How to INITIALIZE variable for 1st stk ONLY, incr for 2nd+?


  • To: amibroker@xxxxxxxxxxxxxxx
  • Subject: [amibroker] Exploration - How to INITIALIZE variable for 1st stk ONLY, incr for 2nd+?
  • From: "Buzz M. Ross" <buzzmr@xxxxxxxx>
  • Date: Thu, 28 Oct 2004 06:27:46 -0000

PureBytes Links

Trading Reference Links


I have a problem with using AFL that probably has a very simple 
solution, but has been eluding me.  I've tried all kinds of 'work 
arounds', but to no avail.  Here's the prob:

I want to use a variable (NOT array) that gets initialized 
(say, 'm=0;') upon the first pass of 'exploration code' applied to 
the first symbol of a watchlist that, say, has 100 symbols.  Then, as 
EACH additional symbol is tested with the exploration, the 'variable' 
should NOT BE RE-INITIALIZED, but rather, is to be incremented by 
one, such as:  ' m = m + 1; '.  This SHOULD be a very simple 
programming exercise, but with AFL, there is the problem that the 
variable 'm' gets re-initialized each time a new symbol's data 
is 'explored'.  I've tried using 'StaticVarSet("m",0), but I can't 
get IT to work either.  Here's the 'meta procedure' I'm trying to 
implement:

0. (AB selects first 'symbol' to be explored and makes it 'current' 
symbol),

1. Initialize a 'counter' variable at beginning of exploration run 
(such as 'm=0'),

2. Calculate conditions of exploration for 'current' symbol's data 
(AB puts True/False results in 'Filter' array),

3. Test 'Filter' array element(s) for condition being met, and 
if 'true', then
       
     a.) increment the 'counter' variable (m=m+1),
     b.) do other 'things',
     c.) [AB outputs 'counter' variable, m, (and other additional 
results) using 'AddColumn(m,"Count",4.0), and other AddColumn
(.....)'s],

4. (AB tests for 'end of watchlist', and if 'true', terminates 
exploration run.  If 'false', sets 'current' symbol to next symbol in 
list), and

5. Jumps back to step #2 to repeat the exploration process.
-------


When trying to 'initialize' the variable 'm' during ONLY the first 
symbol's exploration, in an 'IF (Status("stocknum")==0) {m=0};' 
statement, an error message occurs that says 'm' has to be 
initialized first [just below the 'm=m+1' statement], so this method 
of trying to initialize 'm' ONLY during the exploration of the first 
symbol triggers a compiler error.

I think the solution uses the AFL 'StaticVarSet' and '...Get' 
functions, but I can't get these to work properly.  I would very much 
appreciate some guidance to solve this problem.  Some specific code 
examples would be quite helpful, as the 'manual' is NOT very clear  
about the use of the 'StaticVar....' functions, and I haven't been 
able to find any other 'variables'-related AFL functions that might 
apply.

Thanks a bunch!!

Buzz 
 





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