Welcome Features News Download Registration Support FAQ Wish list Links
Advanced stock charting and analysis program

AFL Library

This is read-only version of AFL library entry. Ability to add user formulas and comment is only available from members-only area.

Details:

Formula name: Export All Daily Data to TXT with MS import format
Author/Uploader: Khalid Mirza - kjmirza [at] gmail.com
Date/Time added: 2008-01-05 06:17:23
Origin:
Keywords: Amibroker metastock convert export
Level: basic
Flags: showemail,function

DISCLAIMER: Most formulas present in AFL on-line library are submitted by the users and are provided here on an "as is" and "as available" basis. AmiBroker.com makes no representations or warranties of any kind to the contents or the operation of material presented here. We do not maintain nor provide technical support for 3rd party formulas.
Description:

this formula will export all tickers to a text file formatted with Metastock Import Format, after export you can use hte downloader or any other utility to convert the TEXT file to MS format

Formula:

/*
Export intraday and EOD data to TXT files 
One file for each stock
In the first line insert the directory you want to save them to, make sure the
directory exists
Select your charts to export with the "Apply to" filter in AA window 
Select the timeframe period you want to save as using the AA "Settings"
Press Scan button
by Graham Kavanagh 05 Feb 2004
*/

fh = fopen( "d:\\newfold\\msdata.txt", "a"); 
if( fh ) 
{ 
   fputs( "<ticker>,<name>,<per>,<date>,<open>,<high>,<low>,<close>,<vol>\n",
fh ); 
   y = Year(); 
   m = Month(); 
   d = Day(); 
   
   for( i = 0; i < BarCount; i++ ) 
   { 
      fputs( Name() +","+ Name() +",d," , 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\n", 
                     O[ i ],H[ i ],L[ i ],C[ i ],V[ i ] ); 
      fputs( qs, fh ); 
   } 
fclose(fh);
} 
Buy=0;

 

Comments:

Khalid Mirza
kjmirza [at] gmail.com
2008-01-05 06:27:04
guys .. i forget to mention that i modified this formula from an existing one here in the library

the information of the original formula is :
gkavanaghFormula name: Export Intraday Data
Author/Uploader: Graham Kavanagh - gkavanagh@e-wire.net.au

Thanks to the original auther

Khalid Mirza
kjmirza [at] gmail.com
2008-01-05 06:27:45
Also, th enew file is located in

fh = fopen( "d:\\newfold\\msdata.txt", "a");


if you need to change the location then change this line

Regrads
dhiraj
dhirajsud [at] gmail.com
2008-01-05 09:52:04
i try my best sir, but its not working, i also make a folder in d/metastock, and change in afl also, but nothing
afl007
afl007[at]gmail.com
2008-01-14 08:11:47
Metastock format should in:
Ticker,MM/DD/YYYY,Open,High,Low,Close,Volume

Those format above could not exported using THe Downloader.


About | Privacy | Terms of Use | Contact information
Copyright © 2001 AMIBROKER.COM