[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Automation and New Backtester



PureBytes Links

Trading Reference Links




Don
not a script, but here is a method that will delete 
quotes for a specified date.  It requires you to export your Database to 
ASCII and then reimport it.  Perhaps a little messy but a lot quicker than 
manually fixing your database.
This AFL will export your entire database to 
Metastock formatted ASCII files.  You need to create a folder in AmiBroker 
Folder called ASCII Quotes.  
Find the line- if(ds != 
"20040210,")  modify 
the date string to your requirements (NOTE - the comma included at the end of 
the date string).  
Set-  Apply to - all stocks and  Range - 
n last quotations  n=1.   Explore,  this exports all tickers 
to TickerCopy.csv files in ASCII Quotes folder (up to 12 years, 2300 stocks 
about 41/2 minutes on my computer 1.7ghtz).  
IMPORTANT
Next - create a NEW DATABASE and use the import 
wizard to Import files.  I've included a snapshot of the import wizard 
settings, but the setup is very straight forward.
It takes about 5 minutes to Import files.  
Next go to old database and copy broker.master  broker.workspace across to 
new database.  Once you have checked and are satisfied with the new 
database you can delete the old and rename the new to whatever you 
called the old database.
 
BEFORE you try this AFL,  BACKUP YOUR 
DATABASE.  I've being using a modified version of this AFL for a while with 
no problems, but take precautions.
 
Hope this helps
 
Andrew
ps.  you could also use the Metastock 
Downloader (Freely available)  to import these files into a Metastock 
Database.
 

// Metastock ASCII export file modified to remove quotes on a specified 
date.
fh = fopen("ASCII 
Quotes\\"+Name()+<FONT 
color=#ff00ff>"Copy.csv","w");<FONT 
color=#800000>
if( fh ) 
{ 
fputs( <FONT 
color=#ff00ff>"<ticker>,<name>,<per>,<date>,<open>,<high>,<low>,<close>,<vol>,<o/i>\n", 
fh ); 
y = Year(); 

m = Month(); 

d = Day(); 

// Check FullName() for the presence of commas, commas will upset string 
format.
WholeName = <FONT 
color=#0000ff>WriteIf(FullName() != <FONT 
color=#ff00ff>"" AND StrExtract(<FONT 
color=#0000ff>FullName(),1)==<FONT 
color=#ff00ff>"",FullName(),<FONT 
color=#0000ff>Name()); 
ThreeCol = <FONT 
color=#0000ff>Name()+","+WholeName+<FONT 
color=#ff00ff>",D,";
<FONT 
face="Times New Roman">for( i = 
0; i < BarCount; i++ ) 
{ 
ds = StrFormat(<FONT 
color=#ff00ff>"%02.0f%02.0f%02.0f,",y[ i ], m[ i ], d[ i ] ); 

// Enter your date to 
exclude here format "yyyymmdd," Note the comma after dd<FONT 
face="Courier New" color=#008000>
// multiple dates can be written as
// if(ds != "20040210," AND 
ds !=<FONT 
color=#008000><FONT 
face="Times New Roman">"20040205,")
<FONT 
face="Times New Roman">if(ds != 
"20040210<FONT face="Courier New" 
color=#ff00ff>,")
{
fputs<FONT 
face="Times New Roman">( threecol, fh ); 
fputs( ds, fh ); 

qs = <FONT 
color=#0000ff>StrFormat("%.4f, %.4f, %.4f, %.4f, 
%.0f, %.4f\n", 
O[ i ], H[ i ], L[ i ], C[ i ], V[ i 
],OI[i] ); 
<FONT 
color=#0000ff>fputs( qs, fh ); 
}
} 
fclose( fh ); 
} 
Filter = 0;
AddTextColumn(ds,"");
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  don 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Wednesday, February 11, 2004 12:20 
  PM
  Subject: [amibroker] Script to delete 
  data on a specified date in the entire database
  Hello 
  group                
  I was wondering if someone has a scipt to mass delete datafrom the AB 
  database for a specific date?What is happening is AB updates from yahoo 
  current eg monday morning9-02-2004 but the data is imported with the 
  previous days date eg sunday8-02-2004. Strange thing is the ASX dosen't 
  trade on a sunday. this has beenhappening for a couple of weeks 
  now.Does anyone have an easy solution to remove data on that day eg 
  8-20-2004from all stocks? eg scriptthanks in advance for any 
  help.RegardsDon McKaySend 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 Sponsor


ADVERTISEMENT



Click Here














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.







Attachment:
Import Wizard settings.jpeg
Description: JPEG image
Attachment:

Attachment: Description: "Description: Binary data"

Attachment: Description: "Metastock ASCII export file delete date.afl"