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

Re: [amibroker] Re: Potential problem with Portfolio Backtester?



PureBytes Links

Trading Reference Links

Hello,

There is a bug in handling margin requirement different than 100%
in portfolio backtester. The problem is that AB will not enter $10K trade
if there is less than $10 cash (even if margin account is used).
Old backtester handles this correctly but new one not.
This is going to be fixed at earliest opportunity.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Fred" <ftonetti@xxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, January 16, 2004 8:43 PM
Subject: [amibroker] Re: Potential problem with Portfolio Backtester?


> I can't speak to how you are using this particular feature.  But if 
> you some how are limiting positon size in another way where the size 
> of the positions don't change whether you use margin or not, than 
> final equity won't change either.  So I guess the question is ... Are 
> your position sizes changing when you introduce 50% margin ? and if 
> not then is that because you are limiting position size in another 
> manner ?
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Al Venosa" <advenosa@xxxx> wrote:
> > Yes, Fred, and in fact I have observed this behavior, too. I have 
> noticed
> > that, with posqty set to 4, and with $100 K total equity, based on a
> > volatility-based positionsize algorighm, you could easily buy $50 K 
> of very
> > low volatility stock, $35 K of a medium volatility stock, $14 K of 
> a high
> > volatility stock, and the remaining $1 K in the 4th, with 
> positionsize
> > shrinking turned on, even though if you had had enough equity 
> remaining, you
> > might have bought $25 K of the 4th stock.
> > 
> > However, one puzzlement that I do have is that, if I set margin to 
> be 50
> > rather than 100 in Settings, it doesn't make any difference in the 
> final
> > equity achieved. You would think the final equity would be double, 
> wouldn't
> > you? Any ideas? The position size statement is:
> > 
> > PosQty = 4;
> > PositionSize = -100/posqty; //this is not the volatility-based 
> positionsize
> > statement I was referring to above
> > 
> > If the total equity is $100 K but margin is 50%, then you really 
> have $200 K
> > total available equity with which to trade, right?
> > 
> > TIA.
> > 
> > Al Venosa
> > 
> > 
> > ----- Original Message ----- 
> > From: "Fred" <ftonetti@xxxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Friday, January 16, 2004 12:21 PM
> > Subject: [amibroker] Re: Potential problem with Portfolio 
> Backtester?
> > 
> > 
> > > Al,
> > >
> > > It appears from the little test I posted that this is exactly 
> correct
> > > and in addition if position size shrinking is turned on it will
> > > invest that left over $700 in something else as well.
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Al Venosa" <advenosa@xxxx> 
> wrote:
> > > > I'd like to know the answer to your question, too. Here is how I
> > > would guess
> > > > AB does it. It determines your TOTAL CURRENT equity at any given
> > > time. You
> > > > said that one of your stocks exited with a $3K profit after a 
> few
> > > days, but
> > > > you didn't say what the other 9 stocks did. Suppose they grew 
> to a
> > > $20 K
> > > > profit collectively. Thus, your total current equity is now 
> $123 K
> > > (the $3K
> > > > profit from your exited position plus the $20 K open profit from
> > > the other 9
> > > > stocks plus the original $100 K invested). So, according to your
> > > > positionsize statement, the new investment would be 10% of $123 
> K
> > > or $12.3
> > > > K. So, you would buy $12.3 K of your new stock rather than $13 
> K,
> > > leaving
> > > > you with $700 uninvested cash. Does this make sense? I don't 
> know
> > > if it is
> > > > correct, however.
> > > >
> > > > Al Venosa
> > > >
> > > >
> > > > ----- Original Message ----- 
> > > > From: <chuck_rademacher@x>
> > > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > > Sent: Friday, January 16, 2004 11:40 AM
> > > > Subject: [amibroker] Potential problem with Portfolio 
> Backtester?
> > > >
> > > >
> > > > > I'm certainly not saying that there is a bug in the 
> backtester.
> > > I just
> > > > wondered what other users think of what I see happening in my
> > > research.  In
> > > > fact, after typing everything that follows, I've come to the
> > > conclusion that
> > > > the problem is in my own AFL.  However, I believe that my 
> coding is
> > > exactly
> > > > or at least similar to what everyone else is doing.
> > > > >
> > > > > I'll attempt to describe the situation:
> > > > >
> > > > > 1.  I'm using the "normal" portfolio backtesting mode with 
> market
> > > timing.
> > > > My systems will typically lay on some number of positions when
> > > the "market"
> > > > turns up and quit all of those positions when the market turns
> > > down.  The
> > > > systems do have 50% loss stops (that are seldom hit) and profit
> > > stops that
> > > > are frequently hit.
> > > > >
> > > > > 2.  Assume we are flat today.
> > > > >
> > > > > 3.  We download our data, run our backtest and place our 
> orders
> > > for
> > > > tomorrow's open.
> > > > >
> > > > > 4.  Assume that we have $100,000 in our account and we have 
> used
> > > > PositionScore to rank our 50 or so buy signals and that we are
> > > going to have
> > > > a maximum of ten positions.
> > > > >
> > > > > 5.  We will have ten buy orders, each for about $10,000.
> > > > >
> > > > > 6.  Let's say that after a few days, one of our positions hits
> > > our profit
> > > > objective and we exit with a $3,000 profit.
> > > > >
> > > > > 7.  This leaves us with $13,000 to invest tomorrow.
> > > > >
> > > > > 8.  Assuming that the market is still in an up-trend, AB (our
> > > AFL) is
> > > > going to find a new stock for us to buy.  I believe that it is
> > > going to
> > > > divide our available funds ($13,000) by ten and that it will 
> invest
> > > only
> > > > $1,300 in the stock that is replacing the stock we quit at our
> > > profit stop.
> > > > Why wouldn't it?  After all, it's my own AFL that says something
> > > like:
> > > > >
> > > > >      PositionSize = -100/posqty;
> > > > > or
> > > > >      PositionSize = -10;
> > > > >
> > > > > The questions I have are:
> > > > >
> > > > > 1.  Do you agree that this is what is happening?
> > > > >
> > > > > 2.  Does this explain why we are not able to achieve the 
> exposure
> > > > percentages that we expect?
> > > > >
> > > > > 3.  Would you like the buy order be for $1,300, $10,000 or
> > > $13,000?
> > > > >
> > > > > 4.  Have you solved this problem yourself with some fancy AFL?
> > > I'm
> > > > thinking that I may, for instance, be able to calculate position
> > > size at the
> > > > beginning of a market cycle and use it throughout that cycle.   
> In
> > > other
> > > > words, I would determine that for the next cycle, all positions
> > > will be
> > > > $10,000.  Profits would just be set aside for the next cycle.
> > > > >
> > > > > I look forward to hearing from those of you who are 
> interested in
> > > this
> > > > subject.
> > > > >
> > > > >
> > > > > 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
> > > > >
> > > > > 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/
> > > > >
> > > > >
> > > >
> > > >
> > > > ---
> > > > Outgoing mail is certified Virus Free.
> > > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > > Version: 6.0.560 / Virus Database: 352 - Release Date: 1/8/2004
> > >
> > >
> > > 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
> > >
> > >
> > > 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/
> > >
> > >
> > 
> > 
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.560 / Virus Database: 352 - Release Date: 1/8/2004
> 
> 
> 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:
>  http://docs.yahoo.com/info/terms/ 
> 
> 
> 

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 ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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/