I think this may work. If
not, you may try to use VarSet/VarGet.
Filter = 0;
for(i = 1; i
< 6; i++) { LoopROC = ROC(C, i);
Filter = Filter OR LoopROC >
10; AddColumn(LoopROC,"Loop" + WriteVal( (i),
1.0)); }
----- Original Message -----
Sent: Saturday, April 29, 2006 1:53
AM
Subject: [amibroker] Looping for
dummies
The following feeble attempt at learning how to use loops to
automate some of my explorations isn't working. I'm obviously missing a
very fundamental concept (probably more than a few fundamental
concepts).
What I am attempting to do with this test exploration is
calculate a 1, 2, 3, 4, and 5 period ROC for each stock and return a list
of all those stocks that pass the filter requirement for ANY of the 1-5
passes (if any of the 1-5 period ROC values is > 10). What is being
returned is a line for each stock with all 5 LoopROC values, but only
for those stocks that pass the filter for the last value of i ---- 5
in this case. (I thought I had hit the jackpot when I saw that I
actually had results that matched the test code on the first
run!).
Believe it or not, this will be a major breakthrough for me if i
can just understand how to do this. TIA for any help with an
explanation.
////////////////////////////
for(i = 1; i < 6;
i++) { LoopROC = ROC(C, i);
Filter = LoopROC >
10; AddColumn(LoopROC,"Loop" + WriteVal( (i), 1.0)); }
// the
following lines are to verify the values of LoopROC
ROC1 = ROC(C,
1); ROC2 = ROC(C, 2); ROC3 = ROC(C, 3); ROC4 = ROC(C, 4); ROC5 =
ROC(C, 5);
AddColumn(ROC1, "1"); AddColumn(ROC2,
"2"); AddColumn(ROC3, "3"); AddColumn(ROC4, "4"); AddColumn(ROC5,
"5");
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
SPONSORED LINKS
YAHOO! GROUPS LINKS
|