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

RE: [amibroker] Re: More on Database Structure and Local Storage



PureBytes Links

Trading Reference Links

Bob:

Thanks for sharing.  I never use Notes so did not appreciate that this
technique is available.

Ken 

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of Bob Krishfield
Sent: Tuesday, July 08, 2008 2:23 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: More on Database Structure and Local Storage

Ken 

Another approach for storing data is to use the text field. I use this
extensively to store positions in my portfolio.  Here is an example of
retrieving a CSV string stored for the current symbol.

// load data from Notes if avail
nlist		 = NoteGet("");
pprice	 = StrToNum(StrExtract(Nlist,1)); //purchase price
target	 = StrToNum(StrExtract(nlist,2)); //target price
tstop	 = StrToNum(StrExtract(Nlist,3)); //stop price
nshrs	 = StrToNum(StrExtract(Nlist,4)); //number of shrs
Buydate   = DateTodatenum(StrExtract(Nlist,5)); //buy date

Saving data is just as simple, by collecting the data in a string and saving
it
using NoteSet().   Hope this helps.

Bob Krishfield

--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> wrote:
>
> Ken,
> 
> Instead of writing to the very same symbol OI field, you may consider 
> writing to separate 'artificial' symbol (like composite).
> That way you will have both: direct access to FT and ability to store 
> what you need.
> 
> The only difference in the code is that instead of using actual 
> symbol, you use artificial one (say with tilde in front).
> 
> Instead of this:
>       for( sig = bo.GetFirstSignal( i ); sig; sig = bo.GetNextSignal( i )
) 
>       { 
>          target = ab.Stocks(sig.Symbol); 
>          qt = target.Quotations(i); 
>          if(qt) 
>          {
> 
> 
> You would need this:
> 
>       for( sig = bo.GetFirstSignal( i ); sig; sig = bo.GetNextSignal( i )
) 
>       { 
>          target = ab.Stocks.Add("~" + sig.Symbol); // create artificial
symbol
>          target.DataSource = 1; // use only local DB
>          qts = target.Quotations; 
>          qt = qts.Add(DateTimeToStr(dt[i])); 
>          if(qt) 
>          {
> 
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "Ken Close" <ken45140@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Tuesday, July 08, 2008 6:59 PM
> Subject: RE: [amibroker] Re: More on Database Structure and Local 
> Storage
> 
> 
> > Barry:
> > 
> > FT has its own datafiles and AB reads these files via the FastTrack
PlugIn.
> > I want to write a ranking score into the OI field of each symbol, as 
> > the calculation of the ranking symbol takes a long time to do itself.
> > 
> > As I have learned, you copy to the local database by doing a Scan 
> > over the entire external database with local set as the source; then 
> > symbol contents are copied.  That is all fine, and I could do my 
> > calc and stick it into OI field, but then the next time I need to 
> > update the local database, the OI fields will be overwritten.
> > 
> > Sort of circular.
> > 
> > Ken
> > 
> > -----Original Message-----
> > From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 
> > On Behalf Of Barry Scarborough
> > Sent: Tuesday, July 08, 2008 8:12 AM
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: [amibroker] Re: More on Database Structure and Local 
> > Storage
> > 
> > There is a parameter for each symbol, Symbol > Information > Use 
> > only local database, yes or no. But that will only keep the data 
> > from being back filled if set to yes and you may not want to do 
> > that. If I read your note right you want to import the data into AB 
> > and then keep it updated from some data source, maybe FT. If so the
parameter has to be set to no.
> > 
> > How did you copy or import the FT data into AB? AB is kind of fussy 
> > about what you put in their database. If you import the data 
> > incorrectly it will blow up every time you try to use the symbol.
> > 
> > What do you want to write into the OI field? When are you trying to 
> > write it?
> > 
> > Barry
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Ken Close" <ken45140@> wrote:
> >>
> >> Can someone explain to me how I make the FastTrack database a local
> > one?  
> >>  
> >> Background: I have had a FT db for years, with local storage
> > disabled?  I
> >> want to write to the OI field and preserve the written data. I
> > checked
> >> "Enable Local Storage" but nothing different happened.
> >>  
> >> Next, I tried to scan all symbols with a simple formula (I
> > remembered having
> >> to do that years ago with a TC2000 database that came on a CD--I
> > thought the
> >> same kind of step was needed.).   Amibroker got hung on a single 
> > symbol and
> >> I had to End Program.  AB would lock if I even clicked on this same
> > symbol.
> >>  
> >> Next, I created a new FastTrack database with a different name and
> > copied
> >> over the appropriate files to the new DB folder. I enabled Local
> > Storage
> >> from the start.  All looked good.  Except that writes to the OI
> > field in the
> >> new DB would not save.  I tried the scan all symbols trick again,
> > and again
> >> it hung on the same symbol, certainly suggesting my FastTrack data
> > itself is
> >> corrupt on that one symbol. (Special updates with the FastTrack 
> >> data designed to correct problems did not seem to change anything.)
> >>  
> >> My question is how do I get the FastTrack database to be local and
> > to allow
> >> writes to the OI field to stick?  
> >> My second question (as I assume I have to have the data in the
> > Amibroker
> >> folders and not just in the FastTrack folders for the AB DB to be
> > local), is
> >> how do I update the nightly downloads of new data which FastTrack
> > will stick
> >> in their own file/folder?
> >>  
> >> Thomasz, can you help?
> >>  
> >> Thanks,
> >>  
> >> Ken
> >>
> > 
> > 
> > 
> > ------------------------------------
> > 
> > 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > http://www.amibroker.com/devlog/
> > 
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> > Yahoo! Groups Links
> > 
> > 
> > 
> > 
> > ------------------------------------
> > 
> > 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > http://www.amibroker.com/devlog/
> > 
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> > Yahoo! Groups Links
> > 
> > 
> >
>




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

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links




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

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto: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/