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

[amibroker] Re: Exploration For Exporting ASCii Intraday Data Won't Work



PureBytes Links

Trading Reference Links

Thanks, Prashanth. I have the code that I've been using to export Eod data to ASCii. It's based on Graham's work and I created it with his help some time ago. It works like a charm with eod files but when tweaked a bit to accommodate intraday data it only works properly if I hit Apply or Verify button from inside the formula editor:

http://img409.imageshack.us/img409/1940/12252006115935vw2.png

If I use the Scan button from AA window the resulting CSV file is nothing more than Eod file with the "Time" field added:

http://img135.imageshack.us/img135/9584/12252006115123mm8.png

The last line in this type of a formula (see below) usually works like a "link" to Scan button, but in this case it fails:

Buy = 0; // link to Scan button

Below is the full code. The reason for the lines with "w" and "a" (overwrite and append) is to first overwrite and old file (if it exists) and then to append the data from each ticker (needed if you want to export data from multiple tickers, eg. from a watch list).

/***************/

output_folder = "C:\\ZZ";
output_file   = "RT.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)
{
  fputs( "Ticker,Date,Time,Open,High,Low,Close,Volume,Trades\n", fh );
   t = Name();
   y = Year();   // to get two digit year use: y = Year()%100;
   m = Month(); 
   d = Day(); 
   r = Hour();
   e = Minute();
   n = Second();
for( i = 0; i < BarCount; i++ ) // loop
  {
  fputs( t + ", " , fh );
  ds = StrFormat("%02.0f/%02.0f/%02.0f, ", m[i], d[i], y[i] ); // date string
  fputs( ds, fh );
  ts = StrFormat("%02.0f:%02.0f:%02.0f, ", r[i], e[i], n[i] ); // time string
  fputs( ts, 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

/***************/

> In Settings change to 1 Minute.
> Use Grahams Intra-Day Export AFL available at Library for a composite Export.
> 
> Prashanth
>   ----- Original Message ----- 
>   From: Lester Vanhoff 
> 
>   I have 1-min chart and run the following exploration:
> 
>   Filter = 1;
>   AddColumn( Open, "Open", 1.4 );
>   AddColumn( High, "High", 1.4 );
>   AddColumn( Low, "Low", 1.4 );
>   AddColumn( Close, "Close", 1.4 );
>   AddColumn( Volume, "Volume", 1.0 );
>   AddColumn( OpenInt, "Trades", 1.0 );
> 
>   However, instead of rows of intraday data I'm only getting eod data:
> 
>   http://img411.imageshack.us/img411/863/12252006022253hr7.png
> 
>   Database Settings:
> 
>   - 1 minute
>   - 6780 bars (I don't have eSignal, so 90000 shouldn't be needed)
>   - hours: 09:30-16:14 and 16:15-09:29
>   - allow mixed/eod data: YES
>   - show day sessison only
> 
>   Tnx



Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.27/602 - Release Date: 12/25/2006 10:19 AM