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

Re: [amibroker] Comment From a newbie



PureBytes Links

Trading Reference Links

Hi Herman,

I have two markets: 0 for NYSE and 1 for NASD. 

I will test run your code posted in the later posting. To use the 
static variable, I think I need to install one of the recent Beta 
versions (I am using 4.5 now).

Thanks for your time on this. I will let you know the result later.

Regards,
Charles


--- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen" 
<psytek@xxxx> wrote:
> Hello Charles,
> 
> Can you explain this line:
> //replace your watchlist number with 0
> //list = CategoryGetSymbols( categoryWatchlist, 0 );
> list = CategoryGetSymbols( categoryMarket , 0 ) + CategoryGetSymbols
(
> categoryMarket , 1 );
> 
> Why two watchlists? Why not use one and select the other with your 
AA
> Filter? I miss something here...
> 
> The common aspect of my Correlation code and your code is the 
StrExtract,
> since they took about the same amount of time to execute it appears 
to be
> the StrExtract() that slows down your code. I am a bit familiar now 
with
> what you want and may tinker with your code on a small watchlist of 
five
> stocks. Placing Trace()s in the code to see where the time goes. 
Comparing
> stocks with stocks is very useful so it would be a code structure I 
could
> use myself.
> 
> I wasn't thinking of using composites, i was thinking of using 
SetVar() to
> store the arrays.
> 
> herman
> 
>   -----Original Message-----
>   From: firstview2000 [mailto:firstview2000_1999@x...]
>   Sent: Thursday, August 05, 2004 2:20 AM
>   To: amibroker@xxxxxxxxxxxxxxx
>   Subject: [amibroker] Re: any ideas to reduce runtime for the 
price RS
> ranking code?
> 
> 
>   Herman,
> 
>   Your afl code also consumed too LONG time to finish: I ran it for 
18
>   minutes, and the estimated time left is 19 minutes. So, it will be
>   in the range of 40 minutes to complete 700 stocks based on this
>   speed.
> 
>   I also tested your AFL in a 517 stock watch list, it took 22 
minutes
>   to complete.
> 
>   For a 53 stock watch list, it took 13 seconds to complete.
> 
> 
>   I thought about your suggestion #1, but could not find any good 
way
>   to reduce the loops. There are a lot of un-necessary repeating
>   calculations in my AFL: the RS of each stock is repeated 700 
times.
>   To avoid this, I need to store RS values for 700 stocks. I think 
it
>   is not good idea to create 700 ATC composites for this purpose. 
what
>   do you think?
> 
> 
>   Other information:
>   The status line of the AA window stated "Running ..." all the time
>   during the exploration.
> 
>   In my AFL preference setting, the quickAFL for indicator is 
checked.
> 
>   Regards
>   Charles
> 
> 
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen"
>   <psytek@xxxx> wrote:
>   > Don't know if it can be improved but i'll think about it; I like
>   this kind
>   > of challenges. Coding is more fun than trading, ooops: i should
>   have said
>   > that in public :-)
>   >
>   > For comparison you may look at the code below which performs a
>   similar
>   > action, it calculates the correllation between each of a group 
of
>   stocks.
>   > Run it on your 700 and see how long it takes. If it is much
>   shorter than the
>   > time-consuming code is not the StrExtract() and you should look 
at
>   your
>   > other lines of code. I would be interested to know how that
>   compares on your
>   > computer. It take less than 10 seconds to correlate 100x100 
stocks
>   for me.
>   >
>   > SetOption("NoDefaultColumns",True);
>   > Filter = Status("LastBarInTest");
>   > list = GetCategorySymbols( categoryWatchlist, 0);
>   > AddTextColumn(Name(),"Correlation",1.0);
>   > Ticker1= Name();
>   > for( Col=0; (Ticker2=StrExtract( List, Col))!= ""; Col++)
>   > {
>   > Var2 = Foreign(Ticker2,"C");
>   > Corr = Correlation( C, Var2, 8);
>   > Color = IIf(Corr>0, colorBrightGreen, IIf(Corr<0,
>   colorRed,colorWhite));
>   > Color = IIf(Ticker1==Ticker2, 1, Color);
>   > AddColumn( Corr, Ticker2, 1.3, 1, Color);
>   > }
>   >
>   > 1) You may have calculations inside your loop that are repeated
>   for each
>   > comparison but that need only be calculated one time for each
>   stock, outside
>   > the loop. You could use an additional loop through the watchlist
>   to create
>   > these variables using SetVar. That way they would be calculated
>   700x instead
>   > of 700^2 x... that would give a 700x improvement for those lines
>   of code.
>   > Your selfRelStrength function comes to mind ...
>   >
>   > 2) some things that come to mind is that you are retrieving 700 
x
>   700 x 3000
>   > (assuming 10 yrs data) bars from your hard disk. You can observe
>   this by
>   > noting the status line at the bottom of the AB screen. The AA
>   doesn't use
>   > QuickAFL so perhaps it would work faster to run this indicator 
in
>   an
>   > indicator using two loops.
>   >
>   > 3) Your code could also create a OSAKA-like table for all stocks
>   and work
>   > from there, with the same objective.
>   >
>   > interesting problem, let me know how you progress, I'll let you
>   know if
>   > something else comes to mind.
>   >
>   > herman
>   >
>   >
>   >
>   >   -----Original Message-----
>   >   From: firstview2000 [mailto:firstview2000_1999@x...]
>   >   Sent: Wednesday, August 04, 2004 1:32 AM
>   >   To: amibroker@xxxxxxxxxxxxxxx
>   >   Subject: [amibroker] Re: any ideas to reduce runtime for the
>   price RS
>   > ranking code?
>   >
>   >
>   >   Herman,
>   >
>   >   I need all available values for the RS ranking for backtesting
>   >   purpose. I could plot a chart showing the rs ranking if I need
>   so.
>   >
>   >   My code performs the following loops:
>   >
>   >   the outer loop is for all 700 stocks in database to have their
>   >   rankings;
>   >   the inner loop is for comparing one stock to every other 700
>   stocks
>   >
>   >   So, there are 700x700=490,000 loops. I don't know if we can
>   reduce
>   >   the number of loops here.
>   >
>   >   In addition, if stock quotes are 1000 bars in length, this
>   ranking
>   >   formula will have 490K x 1000 = 490 million calculations to
>   complete.
>   >
>   >   It takes over 40 minutes to complete, which suggests about 10
>   >   million RS calculations per minute. I don't know if this is a
>   >   reasonable rate, but I just think 40minutes is too long.
>   >
>   >   Thank for your help.
>   >   Charles
>   >
> 
> 
> 
> 
>   Check AmiBroker web page at:
>   http://www.amibroker.com/
> 
>   Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> 
> 
>         Yahoo! Groups Sponsor
>               ADVERTISEMENT
> 
> 
> 
> 
> 
> --------------------------------------------------------------------
--------
> --
>   Yahoo! Groups Links
> 
>     a.. To visit your group on the web, go to:
>     http://groups.yahoo.com/group/amibroker/
> 
>     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.



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