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

[amibroker] OI field uses (more than just unadjusted close)



PureBytes Links

Trading Reference Links

Tomasz,

It is nice to see that the ASCII importer can scale up the 
unadjusted close by 100 to put into the OI field. 

However, the ASCII importer approach is not practical, by itself, if 
one has a database that includes inactive stocks. In such a case, we 
need to make the OI field do double duty. With inactive stocks, 
there needs to be a way to exit those stocks before they run out of 
data. Otherwise, AB will keep that trade "open" until the end of the 
test run, even if the end is years away. As a result, when testing 
several years of data, a trading portfolio of 20 stocks can get 
reduced to 15 or even just 10 actively beging traded (since several 
trades got locked open when data ran out). In one test, I ended up 
with just 1 stock being traded by the end since all the other 
positions were locked open. 

Having several trades locked open in this way can alert one to the 
risk of stocks going inactive, but it also makes it very difficult 
to know about the profit performance of the system being tested. 

One solution is to put a "0" (zero) in the OI field for the last 2 
bars of data of inactive stocks. Thus there is a need for an 
external program (given to me by a kind friend) to pre-process files 
before importing into AB. That pre-importing program can also handle 
putting unadjusted closing prices in the OI fields for all stocks. 

Then one needs to add the following lines of code:

inactiveExit = OI == 0;
myRegularExitSignal = ... my code ...;
sell = myRegularExitSignal OR inactiveExit;

But that creates a new problem - one could get an "inactiveExit" 
sell signal on the same bar as a regular buy entry, and that would 
result in the trade being entered but never exited. You may remember 
I sent in a "possible" bug report before you told me why I was 
getting trades locked open. So another line of code is needed for 
the entry:

OKinactiveEntry = OI > 0;// only enter if OI has no exit signal.
myRegularBuySignal = ... my code ...;
buy = myRegularBuySignal and OKinactiveEntry; 

b

--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
wrote:
> Hello b519b, Fred,
> 
> If you use the following ASCII importer format definition 
> 
> $FORMAT Date_DMY,Open,High,Low,Close,Volume,OpenInt
> $PRICEFACTOR 100
> $SKIPLINES 0
> $BREAKONERR 0
> $SEPARATOR ,
> $DEBUG 1
> $AUTOADD 1
> $CONT 1
> $GROUP 254
> 
> You would be able to have:
> 
> unadjusted OHLC in regular OHLC fields and
> adjusted close in OI field already.
> 
> Since OI field is integer,  the above format definition
> multiplies all prices by 100 (see $PRICEFACTOR 100) to
> avoid truncating 2 decimals.
> 
> All this with already existing versions of AmiQuote and AmiBroker.
> (the only thing required is to change aqh.format file from Formats 
subfolder
> to format presented above)
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "b519b" <b519b@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Friday, October 17, 2003 5:03 AM
> Subject: [amibroker] Re: Uadjusted Yahoo Data - Any news?
> 
> 
> > If one has adjusted close in the "close" field and unadjusted 
> > close*100 in "OI", one can quickly get the conversion factor:
> > 
> > unadjustedClose = OI/100;
> > SplitRatio = Close/unadjustedclose;
> > 
> > unadjustedVolume = Volume*SplitRatio;
> > etc
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Fred" <fctonetti@xxxx> wrote:
> > > Yes except not just adjusted and unadjusted close but a factor 
> > that 
> > > can be used to adjust/unadjust ALL the price arrays AND volume.
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Chuck Rademacher" 
> > > <chuck_rademacher@x> wrote:
> > > > hhmm.... sounds familiar?    What a great idea!
> > > >   -----Original Message-----
> > > >   From: Fred [mailto:fctonetti@x...]
> > > >   Sent: Thursday, October 16, 2003 6:43 PM
> > > >   To: amibroker@xxxxxxxxxxxxxxx
> > > >   Subject: [amibroker] Re: Uadjusted Yahoo Data - Any news?
> > > > 
> > > > 
> > > >   The adjusted .vs. unadjusted is a nice option.  The 
problem is 
> > > that
> > > >   typically one needs both simultaneously.  You MIGHT and I 
> > > emphasize
> > > >   MIGHT as I haven't thought about this much, want to 
consider 
> > just
> > > >   using OI for stocks since they're the only securities that 
> > > typically
> > > >   have splits and really have no use for OI per se.
> > > > 
> > > >   --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" 
> > > <amibroker@xxxx>
> > > >   wrote:
> > > >   > Fred,
> > > >   >
> > > >   > You are absolutely right. I was already thinking about 
that.
> > > >   > This would of course cause increase of database size (I 
am 
> > > thinking
> > > >   > about Chuck for example who wants to put as much quotes 
as 
> > > possible
> > > >   > in RAM for faster backtests) but it is worth considering.
> > > >   > Uenal suggested similar thing in AmiQuote list.
> > > >   > If only a day had more than 24 hours :-)
> > > >   >
> > > >   > By the way: newest Quotes Plus plugin already provides 
such 
> > > option,
> > > >   > you can choose if you want split adjusted or not 
adjusted 
> > data.
> > > >   > (in File->Database Settings->Configure)
> > > >   >
> > > >   > Best regards,
> > > >   > Tomasz Janeczko
> > > >   > amibroker.com
> > > >   > ----- Original Message -----
> > > >   > From: "Fred" <fctonetti@xxxx>
> > > >   > To: <amibroker@xxxxxxxxxxxxxxx>
> > > >   > Sent: Thursday, October 16, 2003 11:52 PM
> > > >   > Subject: [amibroker] Re: Uadjusted Yahoo Data - Any news?
> > > >   >
> > > >   >
> > > >   > > Tomasz,
> > > >   > >
> > > >   > > A suggestion here regarding splits ...
> > > >   > >
> > > >   > > The best of all worlds would to be able have a record 
of 
> > when 
> > > the
> > > >   > > splits actually occured and at what factor and have 
this 
> > > imbedded
> > > >   in
> > > >   > > the data i.e. another array "S" if you will that had a 
> > > cumulative
> > > >   > > split factor in it.  This would allow one to look at 
either
> > > >   adjusted
> > > >   > > or unadjusted data at will.
> > > >   > >
> > > >   > > Fred
> > > >   > >
> > > >   > > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko"
> > > >   <amibroker@xxxx>
> > > >   > > wrote:
> > > >   > > > Yuki,
> > > >   > > >
> > > >   > > > I agree with you. I was just offering some solution 
for 
> > just
> > > >   > > splitting
> > > >   > > > one symbol. Good news are that next beta version of 
> > > AMiBroker
> > > >   (4.45)
> > > >   > > > will have a new flag in the ASCII importer that will 
> > allow 
> > > using
> > > >   > > > getting split adjusted or not adjusted from Yahoo 
> > according 
> > > to
> > > >   your
> > > >   > > preference.
> > > >   > > >
> > > >   > > > Best regards,
> > > >   > > > Tomasz Janeczko
> > > >   > > > amibroker.com
> > > >   > > > ----- Original Message -----
> > > >   > > > From: "Yuki Taga" <yukitaga@xxxx>
> > > >   > > > To: "Tomasz Janeczko" <amibroker@xxxxxxxxxxxxxxx>
> > > >   > > > Sent: Thursday, October 16, 2003 11:31 PM
> > > >   > > > Subject: Re: [amibroker] Uadjusted Yahoo Data - Any 
news?
> > > >   > > >
> > > >   > > >
> > > >   > > > > Hi Tomasz,
> > > >   > > > >
> > > >   > > > > Friday, October 17, 2003, 2:41:59 AM, you wrote:
> > > >   > > > >
> > > >   > > > > TJ> You can use Symbol->Split menu in AmiBroker to 
> > adjust
> > > >   your
> > > >   > > data.
> > > >   > > > >
> > > >   > > > > You sure can, but 1) according to the docs this is
> > > >   irreversible
> > > >   > > once
> > > >   > > > > done, so be careful, and 2) not all those huge 
gaps are
> > > >   splits.
> > > >   > > You
> > > >   > > > > can find places like www.hotquotes.com where you 
can 
> > > *fairly*
> > > >   > > easily
> > > >   > > > > research the splits.  However, (my dear Tomasz) we 
> > need a
> > > >   tweak on
> > > >   > > > > the Database Purify tool, IMHO.  What is needed is 
a 
> > way 
> > > to
> > > >   flag a
> > > >   > > > > particular "split" identified by the tool as *NOT* 
a 
> > > split,
> > > >   and
> > > >   > > have
> > > >   > > > > that flag stick.  Unfortunately, the tool, while 
> > > apparently
> > > >   > > finding
> > > >   > > > > all the splits, also finds a lot of non splits as 
> > well.  
> > > And
> > > >   they
> > > >   > > > > never go away, so you can never run this and get a 
> > clean
> > > >   score.
> > > >   > > > > Always, you will have literally dozens if not 
hundreds 
> > of
> > > >   flags in
> > > >   > > > > the Database Purify output suggesting splits that, 
> > > according
> > > >   to
> > > >   > > the
> > > >   > > > > research record, never actually happened.  Could 
be 
> > that 
> > > some
> > > >   of
> > > >   > > > > those are just erroneous research data too, but 
the 
> > site
> > > >   mentioned
> > > >   > > > > above seems awfully thorough about this.
> > > >   > > > >
> > > >   > > > > Best,
> > > >   > > > >
> > > >   > > > > Yuki
> > > >   > > > >
> > > >   > > > >
> > > >   > > > >
> > > >   > > > > Send BUG REPORTS to bugs@xxxx
> > > >   > > > > Send SUGGESTIONS to suggest@xxxx
> > > >   > > > > -----------------------------------------
> > > >   > > > > 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
> > > >   > > > >
> > > >   > > > > Your use of Yahoo! Groups is subject to
> > > >   > > http://docs.yahoo.com/info/terms/
> > > >   > > > >
> > > >   > > > >
> > > >   > > > >
> > > >   > >
> > > >   > >
> > > >   > >
> > > >   > > Send BUG REPORTS to bugs@xxxx
> > > >   > > Send SUGGESTIONS to suggest@xxxx
> > > >   > > -----------------------------------------
> > > >   > > 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
> > > >   > >
> > > >   > > Your use of Yahoo! Groups is subject to
> > > >   http://docs.yahoo.com/info/terms/
> > > >   > >
> > > >   > >
> > > >   > >
> > > > 
> > > > 
> > > >         Yahoo! Groups Sponsor
> > > > 
> > > > 
> > > > 
> > > >   Send BUG REPORTS to bugs@xxxx
> > > >   Send SUGGESTIONS to suggest@xxxx
> > > >   -----------------------------------------
> > > >   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
> > > > 
> > > >   Your use of Yahoo! Groups is subject to the Yahoo! Terms 
of 
> > > Service.
> > 
> > 
> > 
> > Send BUG REPORTS to bugs@xxxx
> > Send SUGGESTIONS to suggest@xxxx
> > -----------------------------------------
> > 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 
> > 
> > Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/ 
> > 
> > 
> >


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/Tq9otC/XP.FAA/3jkFAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/