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

[amibroker] Looping for dummies



PureBytes Links

Trading Reference Links

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");






------------------------ Yahoo! Groups Sponsor --------------------~--> 
GFT Forex Trading Accounts As low as $250 with up to 400:1 Leverage. Free Demo.
http://us.click.yahoo.com/lpv1TA/jlQNAA/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/