PureBytes Links
Trading Reference Links
|
I think something like this might work:
---
function getString( fh )
{
if( ! feof( fh ) )
result = fgets( fh );
else
result = "none";
return result;
}
filename = "mycsvfile.csv";
fh = fopen( filename, "r" );
FirstBar = LastValue( ValueWhen( Status( "firstbarinrange"
),BarIndex() ) );
for ( i=FirstBar; i<BarCount; i++ )
{
line = getString( fh )
if (line != "none" )
{
DDate = StrExtract( line,0 );
KT = StrExtract( line,1 );
...
}
}
fclose( fh );
---
Bill
--- In amibroker@xxxxxxxxxxxxxxx, "cs22trader" <stangor@xxxx> wrote:
>
> I'm trying to read one line of an external .csv data file for each
> bar. The file nas numbars lines. Something like this would work,
> except that the same first line of the file is read on each bar.
>
> fh = fopen( "c:\\test2.csv", "r");
> DDate = fgets( fh );
> KT = fgets( fh ));
> .....
>
> I think this may be because the file is reopened on each bar?
>
> Can someone help me make this work?
>
> thanks!!
------------------------ Yahoo! Groups Sponsor --------------------~-->
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~->
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 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/
<*> 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/
|