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

[amibroker] Re: FAO-GRAHAM.........Request help with modifying your data export afl code



PureBytes Links

Trading Reference Links


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;






------------------------ 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/