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

[amibroker] Re: Exporting (converting) U.S StockDatabase for .DAT (Metastock).



PureBytes Links

Trading Reference Links

Question ... Is this a NEW US Stocks database or the one they have had
available for 3 or 4 years?  I've seen nothing in Amibroker about a
new US Stocks database.  I am using the Hemscott database that became
available over a year ago.  Its industry groups match Yahoo's and is
an improvement on the original US Stocks database.

R.E.(Dick)Hoierman

--- In amibroker@xxxxxxxxxxxxxxx, "focorba" <focorba@xxx> wrote:
>
> This issue is specially for new users. Amibroker has just released 
> complete databank for all U.S stocks in their site, which is very 
> simple and efficent way to install company&symbol database without 
> need for manual adding per symbol.
> 
> Very simple to get full .TLS database for amibroker. Use following 
> link to to get it.
> 
> http://www.amibroker.com/docs/ab305.html
> 
> Each business areas are placed so well that,
> 
> If any would like to export this same database for .DAT (Metastock) 
> format I found this code provided in here, does anyone know what´s 
> wrong with it ? I created "export.afl" in formulaeditor, but got a 
> lot of syntax-errors - anyone knows what´s wrong in this code ?
> 
> Best Regards,
> 
> Focorba (focorba@xxx)
> 
> /***** START *****/
> 
> // Export data to C:\Trf in MetaStock format: 
> Tkr,D,yymmdd,O,H,L,C,V,I
> 
> // 1) Execution: AA - ApplyTo (set "filters") - Date Range (doesn't 
> work) - Scan
> // 2) If the directory doesn't exist it WILL be created automatically
> // 3) Hitting "verify" or "apply" buttons exports only the active 
> symbol. Use "scan" to export a watch list
> 
> output_folder = "C:\\Trf";
> output_file = "Mseod.csv";
> 
> if ( Status("stocknum") == 0 )
> {
> fmkdir( output_folder ); // if the directory doesn't exists it will 
> be
> automatically created
> fopen( output_folder + "\\" + output_file, "w"); // if the file 
> already exists
> all data will be w=overwritten
> }
> 
> fh = fopen( output_folder + "\\" + output_file, "a"); // a=append 
> needed to get
> all tickers from watch list
> if (fh)
> {
> t = Name();
> p = "D";
> y = Year()%100; // to have four digit year use: y = Year();
> m = Month();
> d = Day();
> for( i = 0; i < BarCount; i++ ) // loop
> {
> fputs( t + "," , fh );
> fputs( p + "," , fh );
> ds = StrFormat( "%02.0f%02.0f%02.0f,", y[i], m[i], d[i] ); // date 
> string
> fputs( ds, fh );
> qs = StrFormat("%.4f,%.4f,%.4f,%.4f,%.0f,%.0f\n", O[i], H[i], L[i], C
> [i],
> V[i], OI[i] ); // quote string
> fputs( qs, fh );
> }
> fclose( fh );
> }
> Buy = 0; // link to "scan" button
> 
> /***************
> "One time switch" is used; it opens the file in overwrite mode once 
> and then runs in append mode rest of the time.
> ***************/
> 
> /***** END *****/
>