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

Re: [amibroker] Re: Why does this simple exploration crash when run or more than 10 tickers?


  • Date: Sun, 21 Feb 2010 15:26:39 +0100
  • From: Tomasz Janeczko <groups@xxxxxxxxxxxxx>
  • Subject: Re: [amibroker] Re: Why does this simple exploration crash when run or more than 10 tickers?

PureBytes Links

Trading Reference Links



Hello,

I was trying to say that running it the way you do is inefficent. It is more efficient to generate the output using Apply to:
"All symbols".

Anyway your formula does NOT crash on my machine.  I used Quotes PLus as data source,
Windows 7 x64 and AmiBroker 4.29.6 (32-bit version).
I run it and it took 3 seconds for 20 symbols.
Generated output had 4246 rows and 22 columns.
Memory consumption on my machine after running this exploration is just 10MB for data
and 30MB for all other data, so in total AmiBroker only used 40MB to run this code.

Something is wrong with your computer (hardware).

Anyway the code below is written better (without code repetition, unecessary multiple calls and all
other bloat). Try this and you should not have any problems.

Filter = 1;

tickers =
"INTU,VMED,JBHT,ADSK,LRCX,SIAL,BMC,MAT,MYL,QGEN,VOD,PCLN,CERN,NWSA,FSLR,ILMN,ORLY,WCRX,ADP";
  

for( i = 0; ( ticker = StrExtract( tickers, i ) ) != ""; i++ )
{
  
SetForeign( Ticker );
  
AddColumn( RSI( 2 ), Ticker, 1.2 );
}


Best regards,
Tomasz Janeczko
amibroker.com

On 2010-02-21 14:22, ramoncummins wrote:
Hi Thomasz, thanks for the speedy reply, v much appreciated.

Please note that I am running the exploration code with ONLY SPY selected as the current symbol in AA - it does not use a filter at all, so your calculation is not correct. It is 1 Symbol (SPY) * Num Bars * 22 Columns.

I am using EOD data, so the number_of_bars is approx 3000. I specifically want a matrix with dates down the side, and tickers across the top, with RSI2 EOD values in the cells - this would be a matrix 3000*20 = 60,000 cells - easily handled in excel. 

I am fully aware of the standard way of running the code, that you mention below - however this does not create a matrix - it creates a list, which then has to be manually formatted for my purposes into a matrix. I plan on rolling this out on the full nasdaq 100, which would mean a list of 3000 * 100 Tickers = 300,000 rows and excel (2003) cannot handle that. It can however, handle a matrix of 3000 rows * 100 Columns quite easily, hence the requirement for the matrix.

I am still stumped as to my original example, why running it on EOD data over 3000 bars * 20 Tickers would crash it. 

Normally, Amibroker would chew something like this up . . .

Thanks again for your assistance

Ramon


--- In amibroker@xxxxxxxxxxxxxxx, Tomasz Janeczko <groups@xxx> wrote:
  
Hello,

Hmm... you are not giving enough details therefore way too much is left 
for guessing
Your formula should not crash, unless you are using some huge number of 
bars (1+ million?) but it is written inefficent and redundant. If you 
run your formula for 20 symbols and all bars (as you seem to be doing) 
you will create 20 rows * Number_of_bars * 22 columns (20 columns for 
symbols +name + date/time)  With say one million bars (number_of_bars) 
you will end up having 440 000 000 cells. This may be reason of running 
out of memory, not to mention that Excel won't take such table.

It is *WAY* more efficient to do it right way, i.e. using the simple code:

AddColumn( RSI( 2 ), "RSI", 1.2 );
Filter = 1;

and setting Apply to "ALL SYMBOLS".

This will make AMiBroker iterate through all symbols and will be MUCH 
faster and LESS resource consuming than using your code. And you will 
end up with table having 20 rows * number_of_bars * 3 columns 
(name+date/time+rsi value),
so with same one million bars under test you will have only 60 000 000 
cells (6 times less than your code).


You mention the dates but you don't mention the INTERVAL? So data are 
from 1998 til now BUT...
at what interval? EOD ? Intraday (1-hour?, 1 - minute ???).

You need to keep in mind that if you are using 1-minute data, assuming 8 
trading hours per day gives 120000 bars per year and 12 years gives 1.44 
million bars. Each bar is 40 bytes. So each symbol intraday 1-minute 
data for 12 years back is about 60MB of data (for quotations alone). 20 
symbols put into cache would be 1.2 gigabyte for data alone. This added 
to nearly one billion cells generated by your formula (assuming that 
your data set is as large as I have been guessing here)

Anyway use
Tools->Performance Monitor
to see free memory changes.

Best regards,
Tomasz Janeczko
amibroker.com

On 2010-02-21 12:40, ramoncummins wrote:
    
Hi everyone,

I am trying to extract RSI(2) data for a group of stocks since 1998, using an exploration. The aim is to end up with dates down the side, and all the tickers across the top, with respective RSI(2) values in the rows. (This is to be dumped into excel later).

The code below works fine (and indeed very quickly) when you limit the number of stocks to the first ten or so, but when I run the exploration over 20 stocks, it freezes and amibroker crashes.

In order to replicate, just take the code below and run the exploration on SPY ONLY between 1998 and Today. It should work fine. Then uncomment the second "batch" of tickers and run it - does this crash your machine? Any ideas as to why?

I have searched the posts for answers but nothing has helped so far. I presume its a memory problem of some sort.

Note that I have the following settings in preferences, Data tab:

In-memory cache: 20 (I have tried 11 as well, per a post from Tomasz)
Max Megabytes: 800

Any help greatly appreciated.

Ramon

//--------------------------------------------

Filter = 1;

function indicator( Ticker )
{
     SetForeign( Ticker );
     myRsi = RSI( 2 );
     RestorePriceArrays();
     return myRSI;

}

AddColumn( indicator( "INTU" ), "INTU", 1.2, 1 );
AddColumn( indicator( "VMED" ), "VMED", 1.2, 1 );
AddColumn( indicator( "JBHT" ), "JBHT", 1.2, 1 );
AddColumn( indicator( "ADSK" ), "ADSK", 1.2, 1 );
AddColumn( indicator( "LRCX" ), "LRCX", 1.2, 1 );
AddColumn( indicator( "SIAL" ), "SIAL", 1.2, 1 );
AddColumn( indicator( "BMC" ), "BMC", 1.2, 1 );
AddColumn( indicator( "MAT" ), "MAT", 1.2, 1 );
AddColumn( indicator( "MYL" ), "MYL", 1.2, 1 );
AddColumn( indicator( "QGEN" ), "QGEN", 1.2, 1 );

// Uncomment below - does it crash your machine?
/*
AddColumn( indicator("VOD"), "VOD", 1.2, 1);
AddColumn( indicator("PCLN"), "PCLN", 1.2, 1);
AddColumn( indicator("CERN"), "CERN", 1.2, 1);
AddColumn( indicator("NWSA"), "NWSA", 1.2, 1);
AddColumn( indicator("FSLR"), "FSLR", 1.2, 1);
AddColumn( indicator("ILMN"), "ILMN", 1.2, 1);
AddColumn( indicator("ORLY"), "ORLY", 1.2, 1);
AddColumn( indicator("WCRX"), "WCRX", 1.2, 1);
AddColumn( indicator("ADP"), "ADP", 1.2, 1);
*/



------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links





      
    



------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

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


  


__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___