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

Re: [amibroker] Looping for dummies



PureBytes Links

Trading Reference Links

Hi Tim:
 
Your original filter statement is equivalent to:
Filter = ROC(C, 1) > 10
Filter = ROC(C, 2) > 10
Filter = ROC(C, 3) > 10
Filter = ROC(C, 4) > 10
Filter = ROC(C, 5) > 10
 
Every line OVERWRITES the value of previous line, so only the last line has effect.
 
The new statements are like:
Filter =0;
Filter = Filter  OR ROC(C, 1) > 10
Filter = Filter  OR ROC(C, 2) > 10
Filter = Filter  OR ROC(C, 3) > 10
Filter = Filter  OR ROC(C, 4) > 10
Filter = Filter  OR ROC(C, 5) > 10
At the end, you have got the accumulative effect of all lines, which meets your "ANY of the 1-5 passes" filter requirements.
 
Hope this helps,
 
- Mark H.
----- Original Message -----
From: Tim Gadd
Sent: Sunday, April 30, 2006 12:19 AM
Subject: Re: [amibroker] Looping for dummies

Mark,

Many thanks!

Your solution appears to work fine, but i can't for
the life of me understand why. Would someone mind
explaining how/why that second filter statement works?

Tim

--- Mark H <amibroker@xxxxxxxxxxxxx> wrote:

> 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 -----
>   From: timgadd
>   To: amibroker@xxxxxxxxxxxxxxx
>   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 Investment management software
> Real estate investment software  Investment property
> software 
>         Software support  Real estate investment
> analysis software  Investment software 
>
>
>
------------------------------------------------------------------------------
>   YAHOO! GROUPS LINKS
>
>     a..  Visit your group "amibroker" on the web.
>      
>     b..  To unsubscribe from this group, send an
> email to:
>      amibroker-unsubscribe@xxxxxxxxxxxxxxx
>      
>     c..  Your use of Yahoo! Groups is subject to the
> Yahoo! Terms of Service.
>
>
>
------------------------------------------------------------------------------
>
>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


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
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS