PureBytes Links
Trading Reference Links
|
Bert,
The solution proposed by Howard using fopen/fputs would look something like the following (only briefly tested, and not necessarily the most efficient implementation):
myCSVFile = "c:\\Temp\\Exploration.csv";
if (Status("stocknum") == 0) { // // Open file, overwriting any existing file, and write the header //
fh = fopen(myCSVFile, "w");
if (fh) { // Make sure header matches same order as AddColumn statements. fputs("Ticker,Date/Time,Close\n", fh); fclose(fh); } } Filter = 1; // Set to whatever value you want. AddColumn(Close, "Close"); // Add whatever columns you want
// Open file, appending to any existing file, and write the data. // Make sure this comes after the setting of Filter.
fh = fopen(myCSVFile, "a");
if (fh) { indices = BarIndex(); firstBar = LastValue(ValueWhen(Status("firstbarinrange"), indices)); lastBar = LastValue(ValueWhen(Status("lastbarinrange"), indices)); dates = DateTime(); symbol = Name();
for (i = firstBar; i <= lastBar; i++) { if (Filter[i]) { // Make sure output matches same order as AddColumn statements. fputs(symbol + "," + DateTimeToStr(dates[i]) + "," + Close[i] + "\n", fh); } }
fclose(fh); }
You can improve upon the above by accepting the file name as a parameter, etc.
I don't have time at the moment to throw togeather an OLE/JScript solution. But, if you particularly want it, I can post a follow up later.
Mike
--- In amibroker@xxxxxxxxxxxxxxx, "bistrader" <bistrader@xxx> wrote: > > Mike, > > I know how to do manually: do an Exploration and then follow with Export. Yet, I want to control within afl. I want afl to put or create the exploration in csv file. I did read Barry Scarborough's Export EOD doc and afl. This is different. I saw Mike's comments about OLE and yours about OLE/js. Have written some very simple js to control running afls. Actually, I got an example from a friend of mine and simply cut and paste it to do what I need. So, I have "some" knowledge about js. Enough to read and understand it. In any case, if you or someone has a simple example than this would be great. I have also ready Harry's comments and tried using fopen and the like. Not giving up. Will keep at it, but if someone has example of exporting exploration then maybe I will get an "ahh, that is what I am doing wrong" moment. Thanks. > > --- In amibroker@xxxxxxxxxxxxxxx, "Mike" sfclimbers@ wrote: > > > > Bert, > > > > Are you still looking for an answer to this? If all you want to do is to save your exploration results as a .csv file, then do as was suggested in an earlier reply: > > > > Click on drop arrow of AA Window "File" button, select "Export...", choose the location on disk that you want to save to. > > > > The above will give you a .csv file of your results. If you want to automate the process, then do as one of the other replies suggested; use OLE to drive and export the exploration (e.g. from JScript). > > > > Mike > > > > --- In amibroker@xxxxxxxxxxxxxxx, "bistrader" <bistrader@> wrote: > > > > > > Howard, I did read documentation. Could not find example of writing exploration in documentation, was having problems and thus the posting here. > > > > > > Bert > > > > > > --- In amibroker@xxxxxxxxxxxxxxx, Howard B <howardbandy@> wrote: > > > > > > > > Hi Bis -- > > > > > > > > The documentation explains how to write data to disk files from within AFL. > > > > > > > > You will need a sequence of: > > > > fopen -- one time to establish the file > > > > a loop that formats the data the way you want it, then calls fputs for each > > > > bar > > > > fclose -- one time to close the file and finalize the write. > > > > > > > > Thanks, > > > > Howard > > > > > > > > > > > > On Wed, Nov 18, 2009 at 9:17 AM, bistrader <bistrader@> wrote: > > > > > > > > > > > > > > > > > > > I would like to create a csv file of an afls' exploration. Does anyone have > > > > > an example? > > > > > > > > > > > > > > > > > > > > > > > > >
__._,_.___
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
__,_._,___
|