PureBytes Links
Trading Reference Links
|
<FONT face=Arial color=#0000ff
size=2>b,
<FONT face=Arial color=#0000ff
size=2>
I
think your code is fine, but here's what I did to incorporate higher slippage
for lower-priced stocks into the calculation:
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>Slippage = Close * <SPAN
class=794310519-26022004>IIF(ActualClose
> 4, 0.0125,
<SPAN
class=794310519-26022004>
IIF(ActualClose > 5, 0.01,
<SPAN
class=794310519-26022004>
IIF(ActualClose > 6, 0.009,
<SPAN
class=794310519-26022004>
IIF(ActualClose > 7, 0.008,
<SPAN
class=794310519-26022004>
IIF(ActualClose > 8, 0.006.,
<SPAN
class=794310519-26022004>
IIF(ActualClose > 9,
0.0055,
<SPAN
class=794310519-26022004>
IIF(ActualClose > 10,
0.005,
<SPAN
class=794310519-26022004>
0.0166)))))));
BuyPrice = Open + Slippage;
etc.
Of course, I didn't think of this until your
post. So, whether you were right or wrong, I appreciate your
post!!
<SPAN
class=794310519-26022004>
<BLOCKQUOTE
>
<FONT face="Times New Roman"
size=2>-----Original Message-----From: b
[mailto:b519b@xxxxxxxxx]Sent: Thursday, February 26, 2004 8:29
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker]
Fixed per share commission issue (was CommissionMode
option)Chuck,You are absolutely right. Adding
a fixed 1 cent/sharecommission rate will not work with backadjusted data.
In fact, adding any fixed per share amount will have thisproblem
no matter where one does it. One could do it as mycode does by adjusting
the buy and sell prices, or by usingthe 4th option in
Settings/General/Commission&rates or withthe new SetOption method. In
every case it would result inunrealistic results. That might explain why
my test resultsfrom 1993-1997 are considerably worse than
from1998-present.I like your suggestion of using the the ratio of
actualprice to adjusted price, but with a bit of a variationWhat
do you think of the following code?RawFee = 0.01; //InterActive charge
for up to 500 sharesActualClose = OpenInterest/100;// from Yahoo or
CSIAdjustedRatio = Close/ActualClose;AdjFee = RawFee *
AdjustedRatio;SetTradeDelays(1,1,1,1);SetOption("PriceBoundChecking",False);//must
be offslippage = 0.005;// 0.005 is 1/2%Commission =
AdjFee;//BuyPrice = CoverPrice = (Open*(1+slippage)) +
AdjFee;SellPrice = ShortPrice = (Open*(1-slippage)) - AdjFee;---
Chuck Rademacher <chuck_rademacher@xxxxxxxxxx> wrote:> b,>
> Knowing what I know about your data, I believe that your>
commission> calculation is fraught with problems.> > Take
a stock that has been backadjusted such that it is> (say) ten
cents> instead of the actual price of (say) $30. Also,
let's> say that you are> going to invest $10,000 in that
stock. AB will buy a> zillion shares, with a> commission
of one cent per share, instead of a few> hundred shares with a>
commission of one cent per share.> > So... how do we get more
accurate slippage figures. I> believe that we have>
to do one of the following:> > a. Simply use a flat
percentage (say 1/2 percent) or> > b. Use an adjustable
percentage that considers the> actual price in its> calculation
(say 1/2% if the actual price is > $5, else> 1%).> >
> You probably could calculate a "cents per share"> commission,
but you would> have to consider the ratio of backadjusted to
actual> prices in such a> calculation. You might end up
with 10 cents per share or> 1/1000th of a cent> per share or
anything in between.> -----Original
Message-----> From: b
[mailto:b519b@xxxxxxxxx]> Sent: Wednesday, February 25,
2004 8:17 PM> To:
amibroker@xxxxxxxxxxxxxxx> Subject: RE: [amibroker]
CommissionMode option (4.51> new feature)> >
> I have my commission on the settings page set to
zero> and I> handle commissions and slippage
directly in my AFL> code.> The following example
shows how to build percentage> (the> slippage part)
and fixed per share amounts into the> price>
array.> >
SetTradeDelays(1,1,1,1);>
SetOption("PriceBoundChecking",False);//must turn it>
off> slippage =
0.005;// 0.005 is 1/2%>
Commission = 0.01;// 0.01 is 1
cent/share> BuyPrice = CoverPrice = (Open*(1+slippage))
+> Commission;> SellPrice = ShortPrice =
(Open*(1-slippage)) -> Commission;> >
b> > --- Thomas Chan <tchan@xxxxxxxxxx>
wrote:> > My tests show that setOption() and the setting
in the> GUI> > interfere each>
> other. Change any of the settings and the result>
changes.> > I ended up> >
disabling the setOption() for now. I tried 'percent>
of> > trade' only.>
>> >> >>
>> >> >>
>> > Thomas>
>> >> >>
> ________________________________>
>> > From: Chuck Rademacher> >
[mailto:chuck_rademacher@xxxxxxxxxx]> > Sent: Tuesday,
February 24, 2004 10:18 PM> > To:
amibroker@xxxxxxxxxxxxxxx> > Subject: [amibroker]
CommissionMode option (4.51 new> >
feature)> >> >>
>> > Has anyone tried to use this new
feature? I can't> get> > it to have
any> > effect on my systems. It doesn't override
the GUI> > settings for> >
commission. I've tried all four modes.>
>> >> > >
__________________________________> Do you
Yahoo!?> Get better spam protection with Yahoo!
Mail.> <A
href="">http://antispam.yahoo.com/tools>
> > Send BUG REPORTS to
bugs@xxxxxxxxxxxxx> Send 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>
> > Yahoo!
Groups
Sponsor>
ADVERTISEMENT> > > > >
>---------------------------------------------------------------------------->
--> Yahoo! Groups Links>
> a.. To visit your group on the web, go
to:> <A
href="">http://groups.yahoo.com/group/amibroker/>
> b.. To unsubscribe from this group, send an
email to:>
amibroker-unsubscribe@xxxxxxxxxxxxxxx> >
c.. Your use of Yahoo! Groups is subject to the> Yahoo! Terms of
Service.> > >
__________________________________Do you Yahoo!?Get better
spam protection with Yahoo! Mail.<A
href="">http://antispam.yahoo.com/toolsSend
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.
|