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

[amibroker] Re: ascii to metastock



PureBytes Links

Trading Reference Links

This code will export data from Ami to ASCii in the old MS Eod format. 

/*** START ***/
// Export data to C:\Test 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:\\Test";
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;
  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 ***/

--- In amibroker@xxxxxxxxxxxxxxx, "chandrakant" <darshan_age@xxx> wrote:
>
> hello senior members,
> i am looking for afl which converts ascii formatt into metastock 
> formatt and exports [ as export data afl is available which can export 
> data amibroker data into .txt or .csv formatt].....
> sorry ... my english is weak ...thank you
>




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/