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

Re: [amibroker] Data structure limits



PureBytes Links

Trading Reference Links

Hello,

Thank you for your e-mail. Below you will find my answers.

> 1. Can I put data with 6 decimal places of precision into the high 
> and low price fields? For example, 111222.333444 (I am using the 
> American system for decimals). Or will AB round these off to 2 or 3 
> decimal points?
Open, High, Low, Close fields are stored as C++ float numbers.
This gives 7-8 significant digits, and 3.402823466e+38 maximum representable 
floating-point number. This means that the following can numbers
can be represented accurately
0.001234567
0.01234567
0.1234567
1.234567
12.34567
123.4567
1234.567
12345.67
123456.7
1234567
12345670
123456700
1234567000
12345670000

and so on...
(the precision is in fact a little bit better than shown in this example)

The volume and open interest are internally stored as a integer value
with maximum of 2147483647


> 
> 2. Is there a maximum number that I can put into the pricefields? 
> Will AB accept numbers that go over 1 million such as123,456,789 or 
> will such a large number be rounded or truncated? Or will the 
> precision be reduced (for example to 1,234,000)? 
The maximum number for OHLC is 34'282'346'600'000'000'000'000'000'000'000'000'000
The precisition is 7-8 digits. See the answer above.

> 
> 3. Can I put negative numbers like -12.34 into the price fields? My 
> experience suggests AB treats negative numbers as zero, or is that 
> only when drawing graphs? Would the negative number still be there 
> for calculation purposes, or does AB change all negative price 
> numbers to zero when importing/storing data?
Internally there is a possiblity to store negative numbers but ASCII importer
does not accept them. 

> 4. For the volume field, it appears that it will accept negative 
> data, but not decimalized data. Thus, -12 would be stored as -12, 
> but +12.34 be stored as just +12 without the decimals. Is that right 
> or have I missed something? Does the OI field behave like the Volume 
> field or the price fields?
Yes, Volume and OI fields are stored as integers.


> 
> 5. A bit more on point 1. There are about 12 data fields I want to 
> import but AB only accepts 6 fields currently. One could use an 
> artifical ticker for each stock, and that has worked for me using 
> the Foreign call to a non-changing indicator ticker, but it would be 
> impractical to make one up for each stock. Not only would I have to 
> import MSFT and MSFT_Xtra and do so for each stock, but my forumlas 
> would have to be changed to test each stock since the Foreign call 
> requires the ticker of a specific stock. And that will not be 
> practical for testing 1,000 stocks..... So I hope to "stack" three 
> or more 3 digit data points into the a single price field (likely 
> the "High" field). For example, 111222.333444 where 111 would hold 
> the first data set and 222 holds the second, etc. But this would 
> only be useful if AB has math functions that would allow me 
> to "extract" the 222 data. Here is how I would have AB step through 
> it to get the 222 data: First round down to no decimal places (Does 
> AB have such a feature?) to get 111222 and then divide by 1000 to 
> get 111.222 and then divide by 1 and take the "remainder" (does AB 
> have a "remainder" math function)? Or am I trying for too much at 
> this stage?

If I were you I would write an ActiveX that handle all the "extra" data I like
to analyse. Then I would use the ability to call COM objects from
AFL to retrieve these data from the ActiveX to my AFL formula.

In this approach you have no limits at all :-)

BTW: Today evening newsletter issue 13/2001 will show how to write ActiveX that
can be called from AFL.

Best regards,
Tomasz Janeczko
===============
AmiBroker - the comprehensive share manager.
http://www.amibroker.com