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

Re: [GT] was posted at [system-traders] Some database questions



assuming that /home/simulation/Perl/GT/MetaStockReaderDark Shadow wrote:
Ok,

Thank you very much for your answer.

you're welcome -- i just hope i can offer usable assistance. i don't
know anything about metastock or how the gt/db/metastock stuff interfaces
with a metastock database

I just want to know how to use the metastock database perl module. In file MetaStock.pm
In line 40 there can be specified where to search for the
DB::metastock::program.

ok -- and you're attached options file sets that pathname to
/home/simulation/Perl/GT/MetaStockReader
i'm guessing you don't need the .pm extension, but we will see ...

Therefore i have been searching for a program to use with that script
and than i found a entry in the systemstrader mailinglist which can be
found here
http://www.geniustrader.org/lists/system-traders/msg00099.html
Therefore i thought that program has to be compiled before i can use the
Metastock perl script. So i compiled it and it leads to errors, when i
use it with the metastock.pm script.
Maybe that was a workaround which is now out of date because that post
was from 2003

sure wish the archives could be searched -- as i recall there might have
been a c program, but it was superseded by the perl modules.


To my Metastock data i use the MLdownloader
http://www.trading-tools.com/mldownloader-historical-stock-quotes-data.htm
which uses yahoo data to generate a Metastock database.

ok i understand that to mean you created a metastock database with MLdownloader
(which might or might not be an actual metastock program, but that
doesn't matter) and the data was fetched from yahoo -- that's fine, about
what beancounter does ...

for some reason i'm unable to get my web browser to view that page. ahha!
the site is temporarily unavailable -- oh. it's german, i'm not literate
in that language.


My options file is attached to that mail.

When i use the options file with changed comments for the
metastock::program directory i get less errors which says the following

Use of uninitialized value in concatenation (.) or string
at ../GT/Conf.pm line 87, <FILE> line 1.
Use of uninitialized value in concatenation (.) or string
at ../GT/Conf.pm line 87, <FILE> line 1.
Can't exec "/home/simulation/Perl/GT/DB/MetaStockReader.pm": Permission
denied at ../GT/DB/MetaStock.pm line 86.

ok i'm thinking
1) this message might have been from options when the
  extension was still on the pathname
or
2) it wasn't

regardless MetaStockReader.pm is a perl module not intended to be
executed from perl via backquotes as being done on line 86 of GT/DB/MetaStock.pm
(    my @results = `$self->{'program'} -r $self->{'directory'} $code`;)

so i'm gonna presume GT/DB/MetaStock is to be used with a *nix program
of some sort ... and while not obvious you don't use GT/DB/MetaStock.pm
and GT/DB/MetaStockReader.pm at the same time.


looking at the pod of GT/DB/MetaStockReader.pm it looks like it will
directly access <metastock> MASTER and the XMASTER files in the <metastock>
directory identified in options file using "DB::metastock::directory" item.

do you have such a directory with files for securities of interest?
sounds like that is what MLdownloader does?

how about a ls -lFatr for that directory just for my interest.
ls -lFatr /home/simulation/MetaStock/Germany/TecDAX/
if there are more than say 30 files then how about a selection
based on filename.

ok -- next steps for you to take

a) if you have a MetaStock like database structure (dirs and files) and it
  appears like you do then
  my suggestion is for you to rework your options to use DB/MetaStockReader
  as the database interface -- heck it just these two lines:
    DB::module			MetaStockReader
    DB::metastock::directory	/home/simulation/MetaStock/Germany/TecDAX/

b) or you could set up the sample text based data files and use DB/Text or
  the newer DB/CSV module ... these require you to identify the content
  of the file columns (open, low, high, close, volume, date/time) and also
  expect one file per security (sample file code (symbol) is 13000)

c) or we could try to get that c-program that reads metastock database files
  working


then something simple like
% cd Scripts
% ./display_indicator.pl -timeframe day --start 2008-02-11 --end 2008-02-22 I:Prices SI CLOSE
should yield something like:
Indicator I:Prices has 1 value ... all values selected
       I:Prices/1  <=> Prices[CLOSE]

       timeframe day, time periods 1036 .. 1044
Calculating indicator ...
Prices[CLOSE]       [2008-02-11] = 125.0400
Prices[CLOSE]       [2008-02-12] = 128.0400
Prices[CLOSE]       [2008-02-13] = 130.7900
Prices[CLOSE]       [2008-02-14] = 130.1400
Prices[CLOSE]       [2008-02-15] = 129.2900
Prices[CLOSE]       [2008-02-19] = 131.4000
Prices[CLOSE]       [2008-02-20] = 131.3800
Prices[CLOSE]       [2008-02-21] = 128.8500
Prices[CLOSE]       [2008-02-22] = 131.4300

(substitute whatever you have for code "SI" SIEMENS A G ADR here in the states)

once the above is working we can move on to ./backtest.pl ...


Can't use an undefined value as an ARRAY reference at ../GT/BackTest.pm
line 122.

The other question was about text database handling with GT.

That was a part of your answer to my text database question

* the text db uses 1 file per security and timebase

This is what i would like to avoid because the mentioned http://ratedata.gaincapital.com/ Gives tickdata which is stored for
every
week in one file. So thats a great amount of data. I dont want to use
tickdata for system development. But i would like to use that tick data
to generate maybe a 5 second timeframe data which lasts over 6 months.
So it would be great for usability if i could say please take file
week-1.csv and week-2.csv and so on, to read the tick data into
Geniustrader. If you know a program which can do that it would be great.
Otherwise i must try to convert it by hand which means a lot of work for
me because i yet dont know so much about perl.

oh you don't want to do that by hand -- let the computer do it by hacking
out some data conversion processing either via perl, sh/sed/awk, or even
a c program.

look into beancounter. (http://dirk.eddelbuettel.com/code/beancounter.html)
it is a perl application built around a true database that stores (only?)
daily price and volume data. for tick data you will likely have to handcraft
something -- your cvs file based stuff sounds reasonable, but you will want
to do some data warehousing after a period of days/weeks/months to reduce
the tick data to something more manageable.



keep us posted on your progress

aloha

ras


Regards



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

DB::module MetaStock
DB::metastock::directory /home/simulation/MetaStock/Germany/TecDAX/
DB::metastock::program /home/simulation/Perl/GT/MetaStockReader
#DB::metastock::program /home/simulation/Perl/GT/DB/MetaStockReader.pm
DB::timeframes_available day

#DB::module Text
#DB::text::directory /home/simulation/Perl/data
#DB::text::options ( "	" , 0 , ".txt" , ("date" => 5, "open" => 0, "high" => 1, "low" => 2, "close" => 3, "volume" => 4, "Adj. Close*" => 3) )

Brokers::module SelfTrade

Path::Font::Arial /usr/X11R6/lib/X11/fonts/TrueType/arial.ttf
Path::Font::Courier /usr/X11R6/lib/X11/fonts/TrueType/couri.ttf
Path::Font::Times /usr/X11R6/lib/X11/fonts/TrueType/times.ttf

Analysis::ReferenceTimeFrame year

#Graphic::BackgroundColor black
#Graphic::ForegroundColor white

Aliases::Global::TFS    SY:TFS 50 10|CS:SY:TFS
Aliases::Global::TFS[]  SY:TFS #1 #2|CS:SY:TFS #1|CS:Stop:Fixed #3