PureBytes Links
Trading Reference Links
|
Tomasz,
Okay, using static variables is the method required. I attempted to
use these in the best manner in which I could interpret the brief
description in the documentation. My attempts failed. I re-read and
re-read the info in the URL's you presented here, and even studied
the 'text string' versions as well. Although I am a skilled
programmer in VB and other languages, unfortunately the description
of usage is NOT sufficient for me to properly apply these functions
in my AB Exploration. Would you kindly give an example coding that
shows SPECIFICALLY how a VARIABLE AND the 'StaticVarSet'/'...Get'
functions are to be used with each other. For instance, I tried the
following code snippet without success -- I get a COMPILER error
telling me (paraphrased) that '...variable 'm' needs to be first
initialized':
---------------
a=StaticVarSet("m",0); //initialize variable m
....
IF (Filter[barcount-1]) //test a Filter condition (THIS works)
{
...
m=m+1; // increment variable m
...
}
AddColumn(m,"Count",4.0); // display CURRENT value of m in a column
----------------
I then tried using: a=StaticVarSet(m,0); [WITHOUT the " (quote
marks) around the variable m, but still no success].
I've read the documentation over and over again, and tried MANY other
alterations, but without success over the past two days. Apparently,
I am missing something very simple, but it's not obvious to me. A
better example than the 'StaticVarGetText' one, specifically using a
NUMERIC variable would be highly appreciated.
Thank you again for your assistance.
Buzz
--------------------
--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx>
wrote:
> Hello,
>
> For that use static variables
> http://www.amibroker.com/f?staticvarset
> http://www.amibroker.com/f?staticvarget
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "Buzz M. Ross" <buzzmr@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Thursday, October 28, 2004 8:27 AM
> Subject: [amibroker] Exploration - How to INITIALIZE variable for
1st stk ONLY, incr for 2nd+?
>
>
> >
> >
> > 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
> >
> >
> >
> >
> >
> >
> >
> > 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 --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/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/
|