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

Re: [amibroker] Re: Q from Holygrail Board



PureBytes Links

Trading Reference Links

Gedi,

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.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "telecheck1" <w_end@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, October 07, 2003 9:50 AM
Subject: [amibroker] Re: Q from Holygrail Board


> Hi Tomasz,
> 
> I am quiet confused, using the sample on N100 list , last 30 days I 
> get:
> 
> 04-Sep-03 Enter Short MSFT 28.43 price *  124.708 Shares  = 3545.44
> while my equity is 10,000. It is more then 2% of equity. Please 
> advise.
> 
> Thanks,
> Gedi
> 
> EnableRotationalTrading();
> SOV1=21;
> 
> BBandWid = 2;
> UBBand = BBandTop(Close, SOV1, BBandWid);
> LBBand = BBandBot(Close, SOV1, BBandWid);
> rScore = 50 - 100 * (Close - LBBand) / (UBBand - LBBand) ;
> 
> PositionSize =  -2 * BuyPrice/(2*ATR(10));
> PositionScore = rScore; 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
> wrote:
> > David,
> > 
> > With the release 4.43 you can do that.
> > 
> > PositionSize variable allows you to control the position sizing on 
> PORFOLIO level.
> > Negative values assigned to it specify the PERCENTAGE of PORTFOLIO 
> equity to be invested.
> > 
> > So for example, if you want to have no more than 5 simultaneously 
> positions open
> > specify
> > SetOption("MaxOpenPositions", 5 );
> > PositionSize = -100/5; // 20% of PORFOLIO equity 
> > 
> > You may also adjust the position size depending on risk 
> (volatility) of given stock:
> > PositionSize =  -2 * BuyPrice/(2*ATR(10));
> > 
> > That way you are investing investing 2% of PORTFOLIO equity in the 
> trade adjusted
> > by BuyPrice/2*ATR factor (the higher volatility the less part of 
> portfolio funds you would put into trade)
> > 
> > As for second part of your question, you can also use ranking 
> criteria to specify which trades
> > are preferred if there are too many candidates than allowed 
> positons or available cash:
> > An easy example from the read me:
> > 
> > PositionScore = 100 - RSI();
> > 
> > will tell backtester to prefer stocks with low RSI (high position 
> score). 
> > AmiBroker would enter trades starting from trade of the highest 
> score until it reaches maximum open pos limit
> > or no more cash is available.
> > 
> > More info is provided in the read me file.
> > 
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> >   ----- Original Message ----- 
> >   From: mrdavis9 
> >   To: amibrokeryahoogroups 
> >   Sent: Tuesday, October 07, 2003 1:51 AM
> >   Subject: [amibroker] Q from Holygrail Board
> > 
> > 
> >   I saw this on the Holygrail board, so I am passing it along to 
> this board. Ron D
> >   ----- Original Message ----- 
> >   From: Ward Jones 
> >   To: holygrailsm@xxxxxxxxxxxxxxx 
> >   Sent: Monday, October 06, 2003 6:33 PM
> >   Subject: [holygrailsm] Re: amibroker questions.
> > 
> > 
> >   My friend DAve Johnson sent, to me, the following email that I am 
> >   incorporating here with a (his) request for information about 
> >   AmiBroker's backtesting capabilities.  Any helpful responses will 
> be 
> >   most appreciated.  Thanks in advance.  Ward
> > 
> >   Ward,
> > 
> >   If you can, ask these knowledgeable people if there is a way in 
> >   Amibroker to simulate position sizing.  The issue with 
> backtesting 
> >   is not generating the trades, it's knowing which trades to take 
> and 
> >   how much money to put into each one.  Many trading systems suffer 
> >   from a condition known as clustering, where many of the trades 
> >   happen in just a few days.  These systems look great 
> statistically, 
> >   but trade unprofitably because most of the time you are not 
> trading 
> >   at all (no trades), and when you do get trades you get too many
> >   to take.  So, what would really be helpful is if you can specify 
> >   equity positions in each trade, specify the limits of equity in 
> all 
> >   positions (so it's realistic), and then define some "tie breaker" 
> >   ranking criteria if there are too many trades to determine which 
> >   ones you enter.  Anything you can find out relative to these 
> >   questions would be helpful.
> > 
> >   Thanks,
> > 
> >   David
> > 
> > 
> > 
> > 
> > 
> >   ---
> >   Outgoing mail is certified Virus Free.
> >   Checked by AVG anti-virus system (http://www.grisoft.com).
> >   Version: 6.0.522 / Virus Database: 320 - Release Date: 9/30/2003
> > 
> >         Yahoo! Groups Sponsor 
> >        
> >        
> > 
> >   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.
> 
> 
> 
> 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/ 
> 
> 
> 

------------------------ 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/