Herman's code would work just as well for an exploration as for any
other purpose. If you cared to, you could remove the file opening
closing from my earlier example and simply call his function from the
loop provided.

e.g.

    for (i = firstBar; i <= lastBar; i++) {
       if (Filter[i]) {
          // Make sure output matches same order as AddColumn statements.
          AddLineToFile(myCSVFile, symbol + "," + DateTimeToStr(dates[i])
+ "," + Close[i] + "\n");
       }
    }


However, that would be inefficient for any exploration that spanned more
than a single bar since it would mean repeated opening and closing of
the file for each bar per symbol, as opposed to just once per symbol.

Similarly, the error handling is different. In the example I posted, if
the file failed to open nothing was written. Using Herman's code, a
second attempt would be made, overwriting any existing data. It's up to
your intended usage to determine which would be more appropriate.

If opting to use Herman's function, I would suggest adding a 3rd
argument for the mode in which the file is to be opened such that any
existing contents can be overwritten when first writing the header (i.e.
using "w" instead of "a").

e.g.

if (Status("stocknum") == 0) {
    // Make sure header matches same order as AddColumn statements.
    AddLineToFile(myCSVFile, "Ticker,Date/Time,Close\n", "w");
}


Mike


--- In [email protected], "bistrader" <bistra...@...> wrote:
>
> Herman's code allows one to write a txt message. Correct? I can not
use it to write the columns of an exploration such as PositionScore and
the like, can I?
>
> --- In [email protected], Mark Hike markhike@ wrote:
> >
> > *There's more than one way to skin a cat ;-)
> > I generally use JScript along with AFL to export the
scan/exploration
> > results because I am familiar with both. (In addition I also use
AutoIt3
> > script to automate the JScript :-))
> > But I like Herman's solution, simple and elegant.
> >
> > - Mark
> >
> > *
> > On Thu, Nov 19, 2009 at 6:58 PM, Herman psytek@ wrote:
> >
> > >
> > >
> > > I don't know what your problem is. Did you try using the
AddLineToFile()
> > > function I posted, it is about as simple as it can get. I create
files from
> > > explorations all the time. It is much simpler than exporting,
importing,
> > > file parsing, using jscript, using OLE, etc. You can save directly
to an afl
> > > file that is used in other code as an include file. One step,
without any
> > > user involvement, to do everything. Give a simple explanation and
tell us
> > > the minimum you need to know to get under way. I think you are
making it
> > > more complex than it is.
> > >
> > > best regards,
> > > herman
> > >
> > > bistrader 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 [email protected], "Mike" <sfclimbers@>
<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 [email protected], "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 [email protected], 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
athttp://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/
> > >
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
>


Reply via email to