Support provided the following. I have posted it as a good addition to the 'knowledge base' on Null handling. Thanks to Tomasz for the *extras* above and beyond the call of duty. Along with other forum posts and the help manual it rounds off everything I want to know about the subject re Ami useage.
Subject: floating point and Null I understand that numeric data can be 'written' with ASCII characters, after all 'we' can use ASCII import to get data. I also understand that Ami is based on IEEE floating point standards. For two data series; index A and stock B with the following four data values (close only): indexA,1.11,2.22,3.33,4.44 stockB,null,5.55,null,6.66 >Q1. Which format does the provider store that data in? >What would be the base2 binary number of the leading Null and the >intradata Null as supplied by the provider? First of all, there is no such thing as Null in IEEE standard (there are: Nan (not a number), +inf (plus infinity), -inf (-ininity)), so Null has to be handled separately by the application and picked arbitrarily. Q1. No Nulls in provider data. Data provider provides only existing bars. Non-trading bars are not reported or are padded with previous bar data >Q2. What binary number or system does Ami store the leading Null >and Intradata Null as (local database)? >When does Ami change the intradata Null to -1 E10? >Is this permanently stored in the database or is it done on the fly? >How does this save time? >Doesn't Ami have to check each bar for Null anyway before changing >the intradata Null. Q2. Regular IEEE. Null in AmiBroker is arbitrarily set to -1e10 and there are checks throughout entire program that provide special handing of this value There are NO Nulls in the data stream at all. Nulls appear in AFL arrays if a) results certain calculations (Like MA) are undefined for first "N" bars (setup bars) b) Foreign() is applied to the data stream without padding so non- matching bars are marked with nulls (i.e. -1e10) >Q3. I understand the function of the intraday Null == -1 E10 >prevents Null propogation and reduces time penalty of >Null checking). >Why did Ami choose -1E10 and not some other binary number? Q3. -1e10 was picked because a) never appears in regular price series b) is outside the range of any technical analysis indicator c) it is easy and reliable to detect >Q4. I assumed that Null == 00000000 OR >1.00000000.00000000000000000000000 (or some variation in binary >form) in line with the ASCII character for space (padding). >How does Ami recognise both leading Null (space?) and intradata Null >(-1E10) as Null? Q4. No, Null is NOT zero in AFL. It must be different because ZERO value is perfectly valid for many indicators and if Null was defined as zero it would become impossible to differentiate between valid indicator value (zero) and undefined (empty) value of null. Please don't be fooled by C/C++ books. In C/C++ NULL constant is zero but this is because C/C++ does not really have true "NULL" (NULL in AFL works like in SQL - it propagates through arithmetic expressions) >Q5. Does the data from providers ever contain more than two >floating point values? >I can't see any need for this unless extra points are introduced >when making split adjustments. Q5. Of course it does. Lots of futures contracts, all currencies require at least 4 decimal digits Tomasz Janeczko --- In [email protected], "David Weller" <[EMAIL PROTECTED]> wrote: > > How does AmiBroker treat Null values? > > > > When there is no current position then following code does not execute as > the return value is a Null. But I think it should. When there are open > positions the value is greater than 0 then this piece code executes fine. > > > > > > if (ibc.GetPositionInfo(Name(),"Avg. cost") <= > LastValue(C)) > > > > I fixed this situation by first checking if( ibc.GetPositionSize( Name() ) > == 0 ) meaning no existing positions and routing only open positions > than > 0 to the above code. > > > > In Hex Null is 000 which is less than all other numbers. Just not > understanding the situation. Working with the IB Interface and really like > this capability. > > > > Dave > 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/ <*> 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: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
