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

Re: [amibroker] Re: Question on Position Size



PureBytes Links

Trading Reference Links




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
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Phsst 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">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 thissubject... 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*** byBuyPrice/(2*ATR(10))factor.Current 
  porftolio equity is available cash + value of all open positions.Now 
  if your CURRENT portfolio equity is 10000and BuyPrice (say you have set 
  trade price to OPEN) is 15.00and last 10 day average true range (ATR) is 
  4.5 then resultingposition size would be:-2 * 15 / ( 2 * 4.5 ) 
  = -2 * 1.666 = -3.333That 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 positionif 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 farstumped me. It has to do with the positionsize function. Suppose 
  I'musing 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 aboveequation, such as increasing the 
  position size by adding 5% of profitsto 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 or498. I guess what I am asking is, how does 
  Amibroker know that anegative number actually means a percent of current 
  equity, and howdoes 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 (<A 
  href="">http://www.grisoft.com).> Version: 
  6.0.525 / Virus Database: 322 - Release Date: 10/9/2003
  Send 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 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 
  
<BLOCKQUOTE 
><FONT 
  face="Courier New">---Outgoing mail is certified Virus 
  Free.Checked by AVG anti-virus system (<A 
  href="">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@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 the Yahoo! Terms of Service.