PureBytes Links
Trading Reference Links
|
<FONT face=Arial
color=#0000ff size=2>Just wanted to post the latest version - I've added a lot
of comments that should help.
<FONT face=Arial
color=#0000ff size=2>
<FONT
face="Courier New" size=1>'**************************************'Purpose:
Run A Procedure in
Amibroker' that will export
quotes from' one database
into CSV files ' and then
import them into ' another
database.''Operation: Name this file whatever
you' wish but give it an
extension' of .vbs. Place it
in your' Amibroker folder
and run it' by double
clicking on the file'
name.' ' Make sure
that you change those' lines
under the !!!!!!! lines' to
match your system.''
Make sure that you have the
' correct format file in the
' format
folder.''The Code: Is written in VB Script and
' runs within "Windows
Scripting' Host (WSH)". I
have included' many
commented out msgbox lines'
that you can uncomment if
you're' having problems.
That way you' have a way to
monitor the progress' of the
script as it executes.''vbScript Help: The following links
will' provide information on
VBScript:' (Be careful of
folded lines)'' <A
href=""><FONT
face="Courier New"
size=1>http://msdn.microsoft.com/library/default.asp?url=""><FONT
face="Courier New" size=1>'' <A
href=""><FONT
face="Courier New"
size=1>http://msdn.microsoft.com/library/default.asp?url=""><FONT
face="Courier New" size=1>'' <A
href=""><FONT
face="Courier New"
size=1>http://www.microsoft.com/technet/community/scriptcenter/default.mspx<FONT
face="Courier New" size=1>'' <A
href=""><FONT
face="Courier New"
size=1>http://groups.msn.com/windowsscript/_homepage.msnw?pgmarket=en-us<FONT
face="Courier New" size=1>''Created By:
dingo'**************************************
<FONT face="Courier New"
color=#0000ff size=1>Dim oABDim oAADim fsoDim fldrDim flsDim
fleDim flenamDim result
<FONT face="Courier New"
color=#0000ff size=1>dim RT_DB_Pathdim EOD_DB_Pathdim Frmla_Pathdim
CSV_Dirdim CSV_FleNamdim FmtFleNam
<FONT face="Courier New"
color=#0000ff
size=1>'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' change the
following paths to suit your
configuration'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!RT_DB_Path
= "C:\Program Files\Amibroker\Data"EOD_DB_Path = "C:\Program
Files\Amibroker\TC2000"Frmla_Path = "C:\Program Files\Amibroker\AFL\EOD
Export.Afl"CSV_Dir = "C:\Program Files\Amibroker\Output"FmtFleNam =
"EOD_To_RT.Format"
<FONT face="Courier New"
color=#0000ff size=1>' declare object for Amibroker and the file system
objectset oAB = CreateObject("Broker.Application")Set oAA =
oAB.Analysisset fso =
CreateObject("Scripting.FileSystemObject")
<FONT face="Courier New"
color=#0000ff size=1>'------------------------------------------' Delete all
csv files in the CSV folder' so that we don't import any old ones' that
may still be
there'------------------------------------------'wscript.echo "Cleaning
Out " + CSV_Dir'------------------------------------------' set the
folder object'------------------------------------------Set fldr =
fso.GetFolder(CSV_Dir)'------------------------------------------' set
the files object'------------------------------------------Set fls
= fldr.FilesFor Each fle in fls flenam =
fle.name
'------------------------------------------ ' make sure
its a csv file
'------------------------------------------ if
right(ucase(flenam), 4) = ".CSV"
then
'------------------------------------------
' Delete this old file
'------------------------------------------
fle.Delete end
ifNext'------------------------------------------' destroy the
folder and file objects'------------------------------------------set
fle = nothingset fls =
nothing '------------------------------------------' Set from
and to dates, and the
watchlist'------------------------------------------with
oAA
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
' change the following settings to suit your configuration
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.RangeMode = 3 .RangeFromDate =
"01/01/2001" .RangeToDate =
"12/31/2002" .ClearFilters .ApplyTo
= 2 .Filter(0, "watchlist") = 29end
with '------------------------------------------' The following
is the "main" code for the' exporting and importing of the
data'------------------------------------------' Load EOD Data
Base'------------------------------------------'wscript.echo "Loading
EOD Database: " + EOD_DB_PathIf oAB.LoadDatabase(cstr(EOD_DB_Path))
Then
'------------------------------------------ ' Load the AFL
for Building the CSV File
'------------------------------------------ 'wscript.echo
"Loading AFL: " + Frmla_Path if
oAA.LoadFormula(cstr(Frmla_Path))
Then
'------------------------------------------
' Run The Scan
'------------------------------------------
'wscript.echo "Running Scan"
result = oAA.Scan
'------------------------------------------
' now load the RT Database
'------------------------------------------
'wscript.echo "Loading RT Database: " +
RT_DB_Path If
oAB.LoadDatabase(cstr(RT_DB_Path))
Then
'------------------------------------------
' import each csv file in the EODexports folder
' set the
files
object
'------------------------------------------
Set fls =
fldr.Files
For Each fle in
fls
flenam =
fle.name
'------------------------------------------
' make sure its a csv
file
'------------------------------------------
if right(ucase(flenam), 4) = ".CSV"
then
'------------------------------------------
' Import the CSV File using the correct
format
'------------------------------------------
CSV_FleNam = CSV_Dir + "\" +
flenam
'wscript.echo "Importing " +
CSV_FleNam
result = oAB.Import(0, cstr(CSV_FleNam), cstr(FmtFleNam))
if result <> 0
Then
msgbox "Error Running
Import"
Exit
For
end
if
end if
Next
oAB.RefreshAll()
'wscript.echo "Saving RT
Database"
oAB.SaveDataBase
MsgBox "Finished"
Else
msgbox "Can't Load RT Database"
End IF else
msgbox "Can't Load EOD Export.Afl" End
If Else MsgBox "Cant Load EOD
Database"End If
<FONT face="Courier New"
color=#0000ff size=1>'------------------------------------------' destroy
all objects'------------------------------------------set fle =
nothingset fls = nothingset fldr = nothingset fso =
nothing
<FONT face="Courier New"
color=#0000ff size=1>Set oAA = Nothingset oAB =
nothing<FONT
face=Arial color=#0000ff size=2>d
From: Prashanth
[mailto:prash454@xxxxxxxxxxxxxxxxx] Sent: Saturday, April 17, 2004
4:54 AMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re:
[amibroker] Multiple file Import
Hi Graham,
The reason for 2 Files is like this. I am just
checking out how the Forex markets Trade and whether my TA methods work there.
While there are paid services available, since I do not intend (atleast for
now) to trade, I am trying to use whatever freeforex data is available.
Someone on this group (I dont remember the name, Sorry) was kind enough to
give some links where one could find free forex data. Data is available upto
the time I download, but I cannot do an update, I would have to download all
the data again or use cut and paste for the latest data. This is very
cumbersome even for 1 pair let alone more. Thomas here showed me a way in
which I could import data from Meta Trader. The data MetaTrader gives is for 1
month only and the old file is always overwritten with the new data. Hence my
wanting to combine both of them.
Regarding the Import file posted by dingo, I have
not tried out. Will try it out. Anyway Thanks for your
suggestions.
Regards
Prashanth K.
<BLOCKQUOTE dir=ltr
>
----- Original Message -----
<DIV
>From:
<A title=gkavanagh@xxxxxxxxxxxxx
href="">Graham
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Saturday, April 17, 2004 1:43
PM
Subject: RE: [amibroker] Multiple file
Import
<SPAN
>Prashanth, I am a bit confused
as to why you would want to have 2 databases. Why not just combine them and
update the one. Or have I become confused as to the purpose of these. What
happens to the data in the 1 month database when it is overwritten, is it
lost? Is your 3 year history not continuous with the 1 month
data?
<SPAN
>There are some script files
recently in this group for importing data, maybe check the recent email
history.
<SPAN
>Cheers,Graham<A
href="">http://e-wire.net.au/~eb_kavan/
<SPAN
>-----Original
Message-----From:
Prashanth [mailto:prash454@xxxxxxxxxxxxxxxxx] <SPAN
>Sent: Saturday, April 17, 2004 4:00
PMTo:
amibroker@xxxxxxxxxxxxxxx<SPAN
>Subject: [amibroker] Multiple file
Import
<FONT face="Times New Roman"
size=2>
<SPAN
>Hello,
<FONT face="Times New Roman"
size=2>
<SPAN
>I had posted this letter
yesterday, but seems to have evoked not response. Hence I am sending
again.
<FONT face="Times New Roman"
size=2>
<SPAN
>I have 2 local files for
each scrip. One file contains the historical database for the last 3 years.
This file doesnt get updated. The second file contains data from the
previous 1 month. The second file gets overwritten whenever new data
comes in and hence at any point of time it contains data for the previous 1
month only. What I want to do is to import the 1st file using ASCII import
and import the 2nd file accoring to a schedule using Java Script file. In
this way, I want to be able to access the historical data and at the same
time have it updated till date.
<FONT face="Times New Roman"
size=2>
<SPAN
>All ideas
welcome.
<FONT face="Times New Roman"
size=2>
<SPAN
>Thanks in
Advance
<SPAN
>
<SPAN
>Prashanth
K.
<FONT face="Times New Roman"
size=2>
<FONT face="Times New Roman"
size=2><FONT
face="Courier New">Send BUG REPORTS to bugs@xxxxxxxxxxxxx<FONT
face="Courier New"><FONT
face="Courier New">Send SUGGESTIONS to
suggest@xxxxxxxxxxxxx<FONT
face="Courier New">-----------------------------------------<FONT
face="Courier New">Post AmiQuote-related messages ONLY to:
amiquote@xxxxxxxxxxxxxxx (Web
page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT
face="Courier New">--------------------------------------------<FONT
face="Courier New">Check group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend
SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Send BUG REPORTS to
bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
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 the Yahoo! Terms of Service.
|