PureBytes Links
Trading Reference Links
|
After the line:
($ticker,$date, $time,$open, $high,$low, $close,$vol) = split /,/;
add the following:
if (lc $date eq "date") {
#look like a header ... print it and continue
print OUT "$_\n";
next;
}
--- Rakesh Sahgal <rakeshsahgal@xxxxxxxxx> wrote:
> Hello
>
> I have downloaded the following script from xmlworks.com. The purpose of
> this scrip is to convert Intraday data exported from AB(using AFL code
> provided by Graham ) into a pseudo EOD format for use elsewhere(TA programs
> that do not support IntraDay format).
>
>
> //////////==========//////////
> use strict;
> my $infile = shift;
> my $outfile = shift;
> my $ticker = shift;
> open (IN,$infile) || die "Open IN failed $!";
> open (OUT,">$outfile") || die "Open OUT failed $!";
> my $month = 1;
> my $day = 1;
> my $year = 1900;
> my ($date,$time,$open,$high,$low,$close,$vol);
> while (<IN>) {
> chomp;
> ($ticker,$date,$time,$open,$high,$low,$close,$vol) = split /,/;
> if ($month == 2 && $day > 28) {
> $month = 3;
> $day = 1;
> }
> $month = '0' . $month if length("$month") < 2;
> $day = '0' . $day if length("$day") < 2;
> $year = '0' . $year if length("$year") < 2;
> $date = "$year$month$day";
> print OUT "$ticker,$date,$open,$high,$low,$close,$vol\n";
> $day += 1;
> if ($day == 31) {
> $month += 1;
> $day = 1;
> if ($month == 13) {
> $year += 1;
> $month =1;
> }
> }
> }
> close IN;
> close OUT;
> __END__
>
> //////////==========//////////
>
> The problem I am encountering is visible by seeing the data from a file
> converted using the above script.
>
> TICKER,19000101,Open,High,Low,Close,Volume
> 3IINFOTECH,19000102,137.6000,138.0000,137.6000,138.0000,136234
> 3IINFOTECH,19000103,137.5000,137.6000,137.1500,137.1500,40269
>
> The heading row contains a date instead of the heading "date". The date that
> should have been inserted in the first row of price data has been instead
> inserted where the heading "date" should have been.
>
> I will be very very grateful if someone can kindly spare some time and help
> me out with this problem.
>
> Regards
>
>
> Rakesh
>
------------------------------------
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/
|