PureBytes Links
Trading Reference Links
|
Here is a PERL script which will convert tics to bars. This script is
currently configured to collect 30-minute bars but can be adapted.
Kent
#!/perl5
$barFile = "";
$barDate = "";
$barMins = 0;
$barHigh = 0;
$barLow = 99999;
$barClose = 0;
$currDate = "";
$currMins = 0;
$currTic = 0;
#---- input data format
#-- 990719 850 1445
#-- 990719 902 1441
#-- 990719 907 1437.5
#-- 990719 948 1440
#-- 990719 1026 1435.1
#-- 990719 1214 1435.5
while (<>)
{
if (/(..)(..)(..) (.+) (.+)/o)
{
$currDate = $1 . "/" . $2 . "/" . $3;
$currMins = int( $4 / 100) * 60 + $4 % 100;
$currMins = int( $currMins / 30) * 30; #-- 30 minute bars
$currTic = $5;
if (($currDate ne $barDate) || ($currMins ne $barMins))
{
if ($barDate ne "")
{
$h = int( $barMins / 60);
$m = $barMins % 60;
print "$barFile,$barDate $h:$m,$barHigh,$barLow,$barClose\n";
}
$barFile = $ARGV;
$barDate = $currDate;
$barMins = $currMins;
$barHigh = $currTic;
$barLow = $currTic;
$barClose = $currTic;
}
if ($currTic < $barLow) { $barLow = $currTic; }
if ($currTic > $barHigh) { $barHigh = $currTic; }
$barClose = $currTic;
}
}
$h = int( $barMins / 60);
$m = $barMins % 60;
print "$barFile,$barDate $h:$m,$barHigh,$barLow,$barClose\n";
-----Original Message-----
From: Owen Davies <owen@xxxxxxxxxxxxx>
To: metastock@xxxxxxxxxxxxx <metastock@xxxxxxxxxxxxx>
Date: Thursday, November 11, 1999 9:01 PM
Subject: Re: RSI variants
Thanks to all who replied to my question about RSI variants.
You brightened my day.
That worked out so well that I've got another question. Some
time ago, I ordered some intraday data from CSI. It comes as
a straight data stream, not broken into bars. I had naively
assumed that a program intended to capture trading data as
it happens would be able to cope with the CSI files (at least
after they were converted to ASCII), but this doesn't seem to
be the case. Can anyone offer a lead to software that will
massage this stuff into N-minute bars?
[Someone on the Omega list (back when I was still stuck with
SuperCharts) had written a PERL routine to accomplish it
and was kind enough to send the text. Then I got super-busy
at work and buried it under one of the piles in my office, where
only an archaeologist will ever find it. Sigh.]
Thanks again.
Owen Davies
|