PureBytes Links
Trading Reference Links
|
Tomasz,
Thanks for the answer. The problem with using the fputs is that I need to build the file line by line, and not vertically like I am now.
For example: (excerpts, not full code!)
-------------------------
...more code
procedure CalcOscillatorStudies(Symbol, xOpen, xHigh, xLow, xClose, xVolume)
{
AddColumn(WinZ(xOpen, 10), symbol + "_WinZ[O:10]");
AddColumn(WinZ(xHigh, 10), symbol + "_WinZ[H:10]");
AddColumn(WinZ(xLow, 10), symbol + "_WinZ[L:10]");
AddColumn(WinZ(xClose, 10), symbol + "_WinZ[C:10]");
AddColumn(DSS(xHigh, xLow, xClose, 4, 4), symbol + "_DSS[4:10]");
AddColumn(REI(xHigh, xLow, xClose), symbol + "_REI");
AddColumn(ValueChart(xHigh, xLow, xClose), symbol + "_ValueC");
AddColumn(ValueChart(xHigh, xLow, xHigh), symbol + "_ValueH");
AddColumn(ValueChart(xHigh, xLow, xLow), symbol + "_ValueL");
}
procedure CalcVolatilityStudies(Symbol, xOpen, xHigh, xLow, xClose, xVolume)
{
//etc...
}
...more code
tickerString = "KLAC,AMAT,NVLS,QQQQ";
tickerString = tickerString + "," + GetBaseIndex() + "," + SectorID(1) + "," + IndustryID(1);
// Output basic stock data
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(O, "Open", 1.3);
AddColumn(H, "High", 1.3);
AddColumn(L, "Low", 1.3);
AddColumn(C, "Close", 1.3);
AddColumn(V, "Volume", 1.0);
// Count number of tickers
for(tickerCount = 0; (sym = StrExtract(tickerString, tickerCount)) != ""; tickerCount++)
{
if(tickerCount == 0) tickerCount = 0;
else tickerCount = tickerCount ;
}
// Loop through tickers and apply transforms
for(ticker = 0; ticker < tickerCount; ticker++)
{
symbol = StrExtract(tickerString, ticker);
xOpen = Foreign(symbol, "O", True);
xHigh = Foreign(symbol, "H", True);
xLow = Foreign(symbol, "L", True);
xClose = Foreign(symbol, "C", True);
xVolume = Foreign(symbol, "V", True);
CalcVolatilityStudies(xSymbol, xOpen, xHigh, xLow, xClose, xVolume);
CalcOscillatorStudies(symbol, xOpen, xHigh, xLow, xClose, xVolume);
}
-------------------------
Now I have all the data calculated into the columnX fields, but I have no way of iterating through the columns. I suppose I could write the above functions to work on a bar by bar basis, but I might as well use Osaka then.
Anyway, it is no big deal, I just thought it might be something easy that I was overlooking...
Thanks.
Daniel
On Mon, 28 Feb 2005 18:29:08 +0100, Tomasz Janeczko wrote:
>
> Daniel,
>
> How about writing directly to file using file functions:
> http://www.amibroker.com/f?fopen http://www.amibroker.com/f?fclose
> http://www.amibroker.com/f?fputs
>
> http://www.amibroker.com/f?StrFormat
>
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "Daniel Ervi" <daniel@xxxxxxxxxxxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Monday, February 28, 2005 5:46 PM
> Subject: [amibroker] Q: Exporting files via AFL only
>
>
>> Hi,
>>
>> A general question for the group.
>>
>> I'd like to export a series of data for use in an external neural
>> network program. I have written an AFL script to build this
>> file using a series of loops to call the AddColumn() command.
>> The result is a Results window populated with about 150 variables.
>> I would like to save this file programmatically from AFL into a
>> CSV format.
>>
>> My question is if there is a way to enumerate the columnX data
>> fields so that I can loop through them and save them?
>>
>> I think the Osaka DLL does what I want (saves the table), but I'd
>> like to stick to native AFL if it is possible. Any thoughts?
>>
>> Daniel
>>
>>
>> Check AmiBroker web page at:
>> http://www.amibroker.com/
>>
>> Check group FAQ at:
>> http://groups.yahoo.com/group/amibroker/files/groupfaq.html Yahoo!
>> Groups Links
>
>
> ------------------------ 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 -----------
> ---------------------------------------------------------~->
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html Yahoo!
> Groups Links
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/
|