I want to export quotes to csv file in Amibroker 4.8 and the following
txt file is open but the export tool is not function.
How could I export quotes?
/*
** AmiBroker/Win32 scripting Example
**
** File: Export.js
** Created: Tomasz Janeczko, December 12th, 1999
** Purpose: Exports quotations to CSV file
** Language: JScript (Windows Scripting Host)
*/
function FormatFloat( number )
{
number = 0.001 * Math.round( number * 1000 );
str = number.toString();
return str.substring( 0, str.indexOf(".") + 4 );
}
var oAB = WScript.CreateObject("Broker.Application");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var oStocks = oAB.Stocks;
Ticker = oAB.ActiveDocument.Name;
oStock = oStocks( Ticker );
var Qty = oStock.Quotations.Count;
WScript.Echo("Export of " + Ticker + " start" );
f = fso.OpenTextFile( Ticker + ".csv", 2, true );
f.WriteLine("$SEPARATOR ,");
f.WriteLine("$FORMAT Ticker,Date_YMD,Open,High,Low,Close,Volume")
for( i = 0; i < Qty; i++ )
{
oQuote = oStock.Quotations( i );
var oDate = new Date( oQuote.Date );
f.WriteLine( oStock.Ticker + "," +
oDate.getFullYear() + "-" + (oDate.getMonth()+1) + "-" +
oDate.getDate() + "," +
FormatFloat( oQuote.Open ) + "," +
FormatFloat( oQuote.High ) + "," +
FormatFloat( oQuote.Low ) + "," +
FormatFloat( oQuote.Close ) + "," +
Math.round( oQuote.Volume ) );
}
f.Close();
WScript.Echo("Export finished" );
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
SPONSORED LINKS
| Investment management software | Real estate investment software | Investment property software |
| Software support | Real estate investment analysis software | Investment software |
YAHOO! GROUPS LINKS
- Visit your group "amibroker" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
