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

[amibroker] Deleting databases



PureBytes Links

Trading Reference Links

Hello,

Since it may not be obvious I would like to note how position sizing is
handled when margin account is used.

Margin account allows you to invest more money than you have and "double your profit" by borrowing from the broker, or by "buying on
margin". Of course, the possibility of also doubling losses is usually not considered, because it is not an acceptable alternative,
even though it is real. The Federal Reserve System through its policy setting Open Market Committee, determines how much brokers and
investment banks can lend their client against their investments. This percentage is called the margin rate. At present, the rate is
set at 50%. This means that for every one dollar in actual value an investor has in his account, he can borrow another dollar. If an
investor has 100 shares of fully paid IBM shares in his account, he can in effect purchase another 100 shares just by using margin.

So with 50% margin account your buying power is 200% of your cash.

Also the meaning of 'portfolio equity' changes a little:
Portfolio equity when margin account is used is considered
as sum of cash plus sum of already open positions MINUS current margin loan.

PortfolioEquity = CASH + VALUE_OF_CUR_OPENPOS - MARGIN_LOAN;

(when no margin is used then margin loan is zero and things work like it was described before).

This way of defining portfolio equity has the advantage of:
- being consistent with 'old' definition
- describe the value of your assets alone (without money borrowed)

With that definition however to use ALL available buying power (200% of your cash)
you would need to use 200% of portfolio equity:

PositionSize = -200; // 200% of equity this provides maximum trade size with margin account

If you open multiple positions at the same time, to fully use margin account you would need to change your position size to:

PositionSize = -200/posqty;
// 200% of equity because of 50% margin -> 100% represents YOUR funds another 100% represents margin loan

Hope this helps.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Tomasz Janeczko" <amibroker@xxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, January 17, 2004 4:37 PM
Subject: Re: [amibroker] Re: Potential problem with Portfolio Backtester?


> Al,
>
> This issue has been addressed in 4.50.8 maintenance update.
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "Al Venosa" <advenosa@xxxxxxxxxxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Friday, January 16, 2004 11:00 PM
> Subject: Re: [amibroker] Re: Potential problem with Portfolio Backtester?
>
>
> > Thanks, TJ. I didn't catch that thread.
> >
> >
> > ----- Original Message ----- 
> > From: "Tomasz Janeczko" <amibroker@xxxxxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Friday, January 16, 2004 4:05 PM
> > Subject: Re: [amibroker] Re: Potential problem with Portfolio Backtester?
> >
> >
> > > Al,
> > >
> > > As Yuki reported a while ago "Margin Requirement" different than 100
> > > in the Settings is not handled properly in "portfolio backtest" mode.
> > > This is known bug and is going to be fixed.
> > >
> > > Best regards,
> > > Tomasz Janeczko
> > > amibroker.com
> > > ----- Original Message ----- 
> > > From: "Al Venosa" <advenosa@xxxxxxxxxxxx>
> > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > Sent: Friday, January 16, 2004 8:34 PM
> > > Subject: Re: [amibroker] Re: Potential problem with Portfolio Backtester?
> > >
> > >
> > > > 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@xxxxxxxxxxxxx>
> > > > 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@xxxx>
> > > > > > 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@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/
> > > > >
> > > > >
> > > >
> > > >
> > > > ---
> > > > 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 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 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/