PureBytes Links
Trading Reference Links
|
I only export to individual files for each symbol. Have not tried it
exporting to a single file. It could be that the "w" which means write
to the file could need to be "a" to add the data to a file (I think
this is correct)
In this case the file will need to exist first as well. I have tried
it and I still get the last symbol writing twice (first and last), but
all others are there as well.
example with "a"
fh = fopen( x + "\\data.txt","a");
unfortunately I am not expert in this area, I just learned from the
examples in the help files, and in other examples posted.
Perhaps someone who actually knows what they are doing with this can help
On 4/22/05, Lesmond V <ebsn247@xxxxxxxx> wrote:
>
>
> Graham, can you be more specific. Obviously, I don't have much
> experience with the looping code. I've been moving IF all over the
> screen and nothing works. The code is pasted below.
>
> > Graham <kavemanperth@xxxx wrote:
> > Move the IF into the loop rather than before it.
>
> The formula will export data to C:\Test\MS_Eod.csv
> in the following format:
>
> Ticker,P,Date,Open,High,Low,Close,Volume,OpenInterest
> $SPX,D,2005/04/18,1142.8700, 1148.9200, 1139.8000, 1145.9800, 0, 0
> $SPX,D,2005/04/19,1148.7000, 1154.6700, 1148.3000, 1152.7800, 0, 0
> $SPX,D,2005/04/20,1153.7200, 1155.5000, 1136.1500, 1137.5000, 0, 0
>
> To run the code:
>
> go to AA - ApplyTo:set "filters" - Range:disregard - Scan
>
> PROBLEM:
> If you set the "Filter" to let's say a watch list, only the last
> symbol from the WL will be exported (with Scan button) and only the
> first symbol with Explore button.
>
> /***************
> Export Eod Data To Metastock
> Based on Graham Kavanagh's code:
> http://www.amibroker.com/library/detail.php?id=327&hilite=fputs
>
> 1) Execution: AA - ApplyTo:set Filters - Range:disregard - Scan
> 2) There is no option to set the date range (AA "Range" is not linked
> to this formula)
> 3) The code exports the data to C:\Test\MS_Eod.csv
> 4) If the directory doesn't exist it will be created automatically
> ***************/
>
> folder = "C:\\Test";
> fmkdir( folder );
>
> fh = fopen( folder + "\\" + "MS_Eod.csv", "w");
> if (fh)
> {
> fputs( "Ticker,P,Date,Open,High,Low,Close,Volume,OpenInterest\n",
> fh );
> t = Name();
> p = "D";
> y = Year();
> m = Month();
> d = Day();
> for( i = 0; i < BarCount; i++ )
> {
> fputs( t + "," , fh );
> fputs( p + "," , fh );
> ds = StrFormat("%02.0f/%02.0f/%02.0f,", y[i], m[i], d[i] );
> fputs( ds, fh );
> qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f, %.0f\n", O[i],
> H[i], L[i], C[i], V[i], OI[i] );
> fputs( qs, fh );
> }
> fclose( fh );
> }
> Buy = 0;
>
>
> 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
>
>
>
>
>
--
Cheers
Graham
http://e-wire.net.au/~eb_kavan/
------------------------ 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/
|