PureBytes Links
Trading Reference Links
|
<FONT face=Arial color=#0000ff
size=2>InLine...
<FONT face=Tahoma
size=2>-----Original Message-----From: john gibb
[mailto:jgibb1@xxxxxxxxxxxxx]Sent: Wednesday, March 31, 2004 6:59
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker]
adding custom info to tickerImportance: High
Hi Herman,
I appreciate your help and have
some questions.
1) the OI approach: If I decide to
use, say, the OI field, as my storage location, must I duplicate the
options-or-not info in the OI field for ALL quotes for each
symbol? (What confuses me is that I am trying to store by-ticker info,
not by-individual-quote or bar info. )<SPAN
class=953082000-01042004><FONT
color=#0000ff>
<SPAN
class=953082000-01042004>
<FONT
color=#0000ff>You can store the same value in all locations, the OI
field is there anyway so I don't think it makes much difference. To store
one value use:
<SPAN
class=953082000-01042004>
<FONT
color=#0000ff>YourSingleNumber = 999;
<FONT
color=#0000ff>AddToComposite(YourSingleNumber,"~"+Name(),"OI");
<SPAN
class=953082000-01042004>
<SPAN
class=953082000-01042004>To read it back you could
use:
<SPAN
class=953082000-01042004>
<SPAN
class=953082000-01042004>Temp = foreign("~"+Name(),"OI");<FONT
face=Arial><SPAN
class=953082000-01042004>
<SPAN
class=953082000-01042004>MySingleNumber
= Temp[0];
<FONT face=Arial
size=2>
2) the ATC approach: I can see
how ATC would work, but would I not need about 2000 composites, one for each
optionable symbol? (This seems excessive and perhaps performance
hindering.)<FONT
color=#0000ff>
<SPAN
class=953082000-01042004>
<FONT
color=#0000ff>Yes, Composites for 2000 stocks seems a little overkill. There
are two DLL in files that will write a data-table to a file on disk, there is
the OSAKA and the xx DLL. OSAKA is supported but I gave up on it in view of
the many crashes I experienced, probably because of the strange things I was
doing :-) you may have better luck.
<SPAN
class=953082000-01042004>
<FONT
color=#0000ff>You can also store your values in strings, this is by far the
simplest and most reliable (for me) (do a search in help for fputs() and
fgets()) if you only want one value per stock, you could store it in a
format like: "AAPL, Value1, ABDE, value2, .... ". Another technique i am using
is to create special directories for custom data files. For example
AmiBroker\StockData\ in which i would save many (!) small files named after
the stock it relates to, for example files named AAPL.txt and ABDE.txt. These
little file each contain one single string holding comma separated data. Here
are two simple functions (you can add some error checks, see Help) you can
use:
<SPAN
class=953082000-01042004>
<SPAN
class=953082000-01042004>function SS( FileName,
String) { fh = fopen(FileName, "w"); if( fh
) { fputs(String, fh ); fclose(
fh ); } return
fh; }
<SPAN
class=953082000-01042004>function RS( Filename
) { fh = fopen(FileName, "r"); Str = fgets( fh
); return Str; }
<SPAN
class=953082000-01042004>
<SPAN
class=953082000-01042004>SS stands for saveString and RS stands for
ReadString. The Filename would be specified for each stock as explained above.
To have it end up in your designated directory you should specify the complete
path ( "C:\\.....\\StockData\\AAPL.txt" ) Note the double slashes! The string
would hold your parameter to save. You create this with
NumToStr(YourParameter,1.4); You can have unlimited small files in such
directories and unless you have to read them for each bar it won't slow you
down too much.
<SPAN
class=953082000-01042004>
<SPAN
class=953082000-01042004>After reading the file you extract your parameter
with StrExtract( String, n) where n is your zero based index to the comma
separated substring that holds your parameter. What is nice with this method
is that you can also save strings (Ticker names).
<SPAN
class=953082000-01042004>
<SPAN
class=953082000-01042004>best regards,
<SPAN
class=953082000-01042004>herman.<FONT
size=2>
-john
<BLOCKQUOTE dir=ltr
>
----- Original Message -----
<DIV
>From:
Herman van den
Bergen
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Wednesday, March 31, 2004 12:36
PM
Subject: RE: [amibroker] adding custom
info to ticker
If
you don't use the OI field then you can use this to store custom
information. To my best recollection AmiBroker numbers have an upper limit
of 2^32, this means you can encode 32 binary True/False bits for each bar.
You can also store Barcount single numbers in the OI array using subscripts,
like OI[0]=value1, OI[1] =Value2, etc.
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>You can further expand this idea by using composites, I have 100s of
composites created something like so:
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>AddToComposite(MyCustomArray, "~"+Name(),"O");
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>This would create composites named ~AAPL, ~ADBE, ~ALTR, etc. that can
be retrieved using Foreign("~"+Name(),"O"); whenever you want to access the
current stock. Of course you can also use the H,L,C,V,OI
fields.
<FONT face=Arial color=#0000ff
size=2>
In
AB there are virtually unlimited ways to "attach" info to specific
stocks!
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>best regards,
<FONT face=Arial color=#0000ff
size=2>herman.
<FONT face=Tahoma
size=2>-----Original Message-----From: john gibb
[mailto:jgibb1@xxxxxxxxxxxxx]Sent: Wednesday, March 31, 2004
2:09 PMTo: amibroker@xxxxxxxxxxxxxxxSubject:
[amibroker] adding custom info to
tickerHi,I want to add an
is-it-optionable ( true/false ) attribute to most of
mytickers.Is there an easy way?I notice that, in the
Symbol|Information dialog, there is a Code field inthe upper right;
maybe this is an appropriate place, although it is not atrue/false
field.thanks-johnSend BUG
REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend
SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Send BUG REPORTS to
bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Sponsor
ADVERTISEMENT
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 the Yahoo! Terms of Service.
|