PureBytes Links
Trading Reference Links
|
EasyLanguage has the command lines NewLine and Spaces(0). NewLine is a carriage
return, and Spaces(0) pads the out put string. I use them in commentary, and
alert strings, and I believe they will work in file output statements as well.
The first dawn of smartness is to stop trying things you don't
know anything about----especially if they run to anything
over a dollar.
Sentinel Trading
rjbiii@xxxxxxxxx
____________________Reply Separator____________________
Subject: CL_Ideas received on Writing to a file from an ela
Author: Jay Mackro
Date: 7/17/99 12:54 PM
Well, as is often the case when you pose a problem to
the "group", you get a number of great ideas back.
Here are two that I received in response to my question
of how to run one system against multiple charts in a
workspace, and consolidate the performance statistics
into a file that could be imported into Excel. I called
this approach the "poor man's portfolio maximizer" -
Ie, I wanted to compare different inputs / different
system logic across a wide range of commodities.
To slightly re-state my problem, I had tried using
a Print(file(filename), X, Y, Z); statement, but that
would over-write the file each time a new chart was
run.
Dennis Holverstott suggested using the fileappend
statement, and offered the following example:
>
>If LastBarOnChart then FileAppend ("c:\direct\filenam.csv",
> GetSymbolName + "," +
> numtostr(NetProfit,2) + "," +
> numtostr(NumWinTrades,0) + "," +
> numtostr(TotalTrades,0) + newline);
>
>Keep the directory and file names to the 8 character DOS limit.
That did work, but produced a file with all of the data in one
long row. Ie, I had wanted a file that looked like the printlog
when it displays the results of multiple system runs - each
chart's data appears in a separate line. Using fileappend
never created any line breaks, so when I imported the
resulting file into Excel, I just got one row with many many
columns. Yea, I could have manually chopped it up, but my
goal was to come up with a means of quickly comparing
different variations to my system.
Bob Fulks had a different suggestion
>Why not just write to the print log. You can then "print" the print
>log to a "generic character printer" but assign the printer to a
>file. This will allow you to see the print log as it is running to
>make sure everything is OK then save it if it looks OK.
>You might want to clear the print log before your run also.
This idea worked very well. I had no idea you could configure
a printer in Win95 as "generic text only", but you can. Then,
when you send to this "printer", you can specify a file name.
The only weirdness in this was that the resulting file had a
bunch of rows containing odd characters as its first several
lines - I assume this results from the printlog's odd habit
of pushing all the text to the bottom, rather than starting at the
top. Anyhow, these rows could be easily deleted in Excel,
the columns added, and my system results tabulated.
Additional ideas and suggestions were also offered by:
Dale Carrol, Howard Jackson, Michael Stewart, Peter
Ryan, Clyde Lee, and Russ (TWA7663@xxxxxxx).
Thanks to all, and I hope this proves helpful to others.
Jay Mackro
- Subscription Information link -
http://www.markbrown.com/list.htm
|