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

Re: [amibroker] Re: How raw signals are converted to trades and how then trades are picked based on score in regular backtest mode



PureBytes Links

Trading Reference Links

Hello to Amibroker group:

This is my first posting, so a little background:

I subscribed to CSI almost a year ago because of their reputation for
accuracy.  

I purchased Amibroker just after 4.5 was released.  My decision to
purchase Amibroker (instead of the many other similar programs) was
based in part on what I could tell from my newbie perspective
regarding its value per dollar spent.  But the larger reason to choose
Amibroker was the quality of the discussions archived on purebytes and
the enthusiasm of the Amibroker group for Amibroker and for Tomasz.  

I've never traded a single stock share, yet.  I've been learning how
to do technical analysis and developing a trading system.  I've been
more than a little frustrated by the difficulties involved in getting
CSI data out of Unfair Advantage software and into Amibroker.  I
wanted to use the ten years of historical data available to me as per
my subscription to CSI.  Back when I started, the UA to Ami option
didn't exist.  So I had to write the CSI database out to ascii and
import to Ami.

Problem 1:  UA portfolio limit
Unfortunately as any of you know who use CSI, they have a 7500 stock
limit for what you can put into a portfolio.  So to write out the
historical data base you have to construct a portfolio, write it out,
copy it to a new location, delete it from UA and start over.  This is
time-consuming on my 1 Gigahertz computer.  

Problem 2: Amibroker database limitation
As you know, Amibroker has a limit on how many stocks will fit in any
given database folder, and as the CSI ascii names for the historical
stocks all start with the letter S, only a very small fraction will
get transferred unless you rename the files.  I found a bulk rename
utility for that task and split the stocks into ten "pots" of stocks
starting with numbers 0 through 9.  I think that met the Amibroker
database limits, but I'm not sure, looking back.  Oh, well.  

The ideal answer would be for CSI to provide the CSI number as an
additional field for output to ascii, and then Amibroker could append
the field during import.  If anyone else would like this option (you
have a lot more control with ascii than with the UA to Ami import),
PLEASE contact CSI customer service and/or Steve, the programmer at CSI.


To my relief, recently I discovered that CSI now provides the
functionality to export directly to Amibroker.  I downloaded 2.7.8 and
set to work:

PROBLEM 1: RUN AS ADMINITRATOR
It took me quite a while to figure out that I needed to be signed on
as an administrator in order to get CSI to recognize Amibroker. 
Nowhere in the documentation is that little tidbit mentioned, but
Steve at CSI confirmed that in fact CSI writes to the registry so you
need to be signed on as an administrator to make the transfer work. 
This is annoying as for security reasons normally I don't use my
administrator account.

PROBLEM 2: DROPPED STOCKS
This problem I discovered only when I started doing some very careful
comparison of what was getting transferred to Amibroker compared to
what was in the UA database.  If you check, you may find that you are
missing a lot of stocks.  I noticed AINN and NVDA as missing from
Amibroker.  I am referring to when you transfer over the historical
database - I'm not sure if a transfer of only the active stocks
results in missing stocks.  The trading system I am developing uses
custom indexes and so I need the historical database, not just the
active stocks.  

I talked to Steve and he said one other Amibroker member had contacted
him with the same problem and the same missing stocks.  Steve said
only the two of us had reported any problems with stocks not
transferring over.  Steve said the problem was that UA transfers over
50 stocks at a time and some of the last few stocks were getting
dropped from each transfer.  

Somewhere in the back of my mind it seemed to me that UA was at least
in part a 16-bit application.  So I googled around and found that
there is this file on windows 2000 (and XP) called config.nt (was
config.sys on older OSs).  The default settings on config.nt call for
only 40 files to be used at a time by a 16-bit application.  I changed
the number to 255.  I have no idea at all whether that makes a
difference or not.  What I do know is that Steve's explation doesn't
fit with what is happening on my computer.  For the record, I run a
"harder than normal" (in terms of security measures) windows 2000pro,
sp3, 1gigahertz, 512mb ram, with 1.5gig pagesys file.  

Experiment I ran:  I transferred successively into fresh databases
(renaming the previous database each time) from UA to Amibroker,
always historical with symbol followed by csinumber as the stock name,
using the database updated 20040618 early in the AM (so as to
eliminate variables from updating the UA database), using UA278,
databases requesting 25 days, 30 days, 100 days, 300 days, 2750 days,
and 3000 days worth of UA data.  (if you don't rename and start with a
fresh database, UA 078 imports on top of the existing stocks from the
last go-round, so you can't tell what gets dropped in the longer
imports - not a workaround! as the stocks that do get dropped, don't
get the longer range of days - sorry that sounds really confusing)

ALL stocks transferred successfully for 25 and 30 days worth of data.  

Four stocks failed to transfer when I asked for 100 days of data, with
the following csi numbers dropped:  3627,49172,49173,49189,49202. 

107 stocks failed to transfer when I asked for 300 days of data, with
the bulk of the stocks falling in the 40,000 to 50,000 csinumber
range, plus 3600,3601,3602,3605 outside the 40,000 to 50,000 range.  

142 stocks failed to transfer when I asked for 2750 days of data, and
133 failed to transfer when I asked for 3000 days of data.  In these
cases the stocks fell in clumps scattered through the range of csi
numbers but NOT in any pattern that supports a dropping of the last
few in each transfer of 50, as per what Steve said.  The list of
stocks that don't transfer doesn't just get longer, it also changes. 
For example, AINN transfers when I ask for 3000 days, but not when I
ask for 2750 days.

I watched my windows task manager as the transfers happened.  The
transfers use memory up to the physical limit of the ram, doesn't use
the pagesys file at all.  Perhaps there is a memory limit problem?  If
so, it's inconsistent, as there are a few more missing stocks from the
2750-day tranfer than from the 3000-day transfer.  I ran the 3000-day
tranfer multiple times with different config.nt settings regarding
memory limits and the settings made no difference at all - the same
133 stocks got dropped each time.   

If anyone wants to repeat my experiment on their own computer, I
created the list of theoretical stocks that should tranfer by running
UA 280, which gives the option of creating a csv file of the
factsheet.  A lot of the stocks that are on the factsheet won't
transfer because they never really traded - look for missing "start
date" information on the fact sheet.  Plus there are a few stocks
listed as index stocks that won't transfer because they are special
indexes CSI creates - nasdaq unchanging and that kind of thing - the
complete? list is csinumbers: 4000,5493,5500,5798,5800,5960.

I used AFL code  and exploration mode to create a list of stocks that
transferred to Amibroker for each CSI import, as follows:
numberbars=BarCount;
AddColumn(numberbars,"number bars");
firstdate=BeginValue(DateNum());
lastdate=LastValue(DateNum());
Buy=DateNum()==Lastdate;
Filter=Buy;
AddColumn(lastdate,"lastdate");
AddColumn(firstdate,"firstdate");

A note of caution - you have to be careful copying the Exploration
results to Excel - if you don't format the first column of Excel as
"text" you will find that some stocks - for example MAY-5572 - will
transfer as a date, May-72, and if you then reformat the column as
text, you will have a string of numbers and your
stock-symbol-csinumber information will be gone.  The same thing will
happen if you save as a csv file and reopen into Excel.  


PROBLEM 3: UA 280 DOESN'T WORK
Well, Steve says that UA280 solves the problems of dropped stocks. 
Unfortunately, the UA transfer doesn't work AT ALL on my computer when
I run UA 280.  Does anyone out there in Amibroker land have the UA to
Amibroker transfer working with UA280?  Anyone else try it and have it
not work at all?  Please let Steve know and the Amibroker group might
like to know and I would really like to know because I want this
transfer thing to work well.

A side-note: apparently CSI can EASILY make it an option to flag the
OTC stocks that are on the nasdaq national market, a bit of
functrionality that has been added and removed in the past.  Steve
says - contact customer service if you want it back.  Keeping track of
NASD NM stocks is a PIA.  So, contact customer service!!! 

Sorry to be such a long-winded newbie here!  And many, many, many
thanks to all the Amibroker users who have made such fantastic
contributions to the group knowlege base.  Many questions that I have
had along the way had answers waiting in the purebytes archives.

CC





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/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/