PureBytes Links
Trading Reference Links
|
Al,
How about this? Adding the E1 as a percentage of current equity and
add it to the 2% initial value?
E=Equity(1);
NetE = E-100000; //net profit
E1=iif(NetE>=10000,0.05*NetE,0);
E2 = E1 / E * 100;
PositionSize = -(2 + E2);
Thomas
--- In amibroker@xxxxxxxxxxxxxxx, "Al Venosa" <advenosa@xxxx> wrote:
> Thanks, Phsst, but that's not really what I asked. I read and
understood that post by TJ. What I wanted to know was how do you ADD a
factor to the % of current equity. I could just have easily asked the
same question using TJ's example (in fact, this is more in lne with
what I'd really like to know):
>
> PositionSize = -2*buyprice/(2*ATR(10));
>
> If the buyprice is 30 and the ATR is 1, then the above equation is
-2*30/2 = -30, which is 30% of current equity, or $30,000. How do I
ADD to the above 5% of net profits over $10,000 and adjust that amount
by the buyprice/2*ATR?
>
> E=Equity(1);
> NetE = E-100000;
> E1=iif(NetE>=10000,0.05*NetE*buyprice/(2*ATR(10),0);
>
> I want to add the last amount to the first positionsize statement.
However, the following statement is not the correct way to do it:
>
> PositionSize = (-2*buyprice/(2*ATR(10))) + E1;
>
> In that case, algebraically, it would be -2*30/2 + 0.05*10000*30/2 =
-30 + 7500 = 7470, which is not the correct answer. The correct answer
that I'm looking for is 2% of 110,000*30/2 + 5% of 10000*30/2 = 33000
+ 7500 = 40,500. What this boils down to after factoring is (30/2)
*(2200+500). The 2200 + 500 represent 2.4545% of current equity
(2700/110000) adjusted by buyprice/2*ATR.
>
> AV
>
> ----- Original Message -----
> From: Phsst
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Thursday, October 23, 2003 10:14 PM
> Subject: [amibroker] Re: Question on Position Size
>
>
> Al,
>
> I have clipped a couple of notes that Tomasz published on this
> subject... hope they help.
>
> Phsst
>
> --------------------------------------------------------------
>
>
> The size of the position in the code below is NOT fixed at 2%.
> It is neither 2% of your initial equity.
>
> The position size term is:
> PositionSize = -2 * BuyPrice/(2*ATR(10));
>
> It means 2% of CURRENT portfolio equity ****ADJUSTED*** by
> BuyPrice/(2*ATR(10))
> factor.
>
> Current porftolio equity is available cash + value of all open
positions.
>
> Now if your CURRENT portfolio equity is 10000
> and BuyPrice (say you have set trade price to OPEN) is 15.00
> and last 10 day average true range (ATR) is 4.5 then resulting
> position size
> would be:
>
> -2 * 15 / ( 2 * 4.5 ) = -2 * 1.666 = -3.333
>
> That means 3.33% of current equity.
>
> This is what I called that this is 2% ADJUSTED by volatility
factor.
>
> If stock had low volatility 10 day ATR would be 1.5 then you would
get
> -2 * 15 / 1.5 =
> - 20 -> 20% of equity
>
> The adjustment I mentioned increases the size of position
> if volatilty (risk) of stock is low.
> -----------------------------------------------
> For similar results you may use also:
>
> PositionSize = -2 * BuyPrice / (20*ATR(10) );
>
> (would be then 2.5% of equity for MSFT for that day).
>
> but anyway feel free to experiment :-)
> ----------------------------------------------
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Al Venosa" <advenosa@xxxx>
wrote:
> > Hi, all:
> >
> > I'm embarrassed to ask this simple question, but it has so far
> stumped me. It has to do with the positionsize function. Suppose
I'm
> using the following positionsize statement with an initial equity
of
> $100,000:
> >
> > PositionSize = -2; //invest 2% of current equity in each trade
or $2000
> >
> > Now, suppose I wanted to add a term to the right side of the
above
> equation, such as increasing the position size by adding 5% of
profits
> to future purchases after making $10,000. I first define net
equity,
> then define the % of profits to be added:
> >
> > E=Equity(1);
> > NetE = E-100000; //net profit
> > E1=iif(NetE>=10000,0.05*NetE,0);
> >
> > What would the new positionsize statement be? Obviously, it
would not be
> >
> > PositionSize = -2 + E1;
> >
> > because algebraically, the right side of the equation is -2 +
500 or
> 498. I guess what I am asking is, how does Amibroker know that a
> negative number actually means a percent of current equity, and
how
> does one add to that amount if he wants to increase his bet size?
> >
> > Al Venosa
> > advenosa@xxxx
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003
>
>
> Yahoo! Groups Sponsor
> ADVERTISEMENT
>
>
>
>
>
> 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.
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003
------------------------ 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
---------------------------------------------------------------------~->
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/
|