PureBytes Links
Trading Reference Links
|
Al,
about the part: "Your suggestion to limit positionsize not to exceed
any more than 20% of equity may be the solution since it goes hand in hand with
the philosophy of money management. That is, do not allow any one position to
exceed, say, 10 or 15 percent of your equity. The Turtles did that, and I think
lots of traders do that, too. So, I see nothing wrong with that. Have you coded
this in AFL"
I think you can solve this using:
rsk = -2; // 2%
PositionSize = Max(-20,rsk *
Ref(C,-1) / stopLoss);
now it will never use more than 20% of
equity.
About the minimum number of trades I don't know.
In my system that would be impossible because sometimes good entries just dry up
and I can't find even find 5.
rgds, Ed
----- Original Message -----
Sent: Sunday, December 12, 2004 3:11
PM
Subject: Re: [amibroker] Re: PositionSize
/ Capital
Dan:
Thanks for the ideas.
You're not rambling; you're thinking, and this discussion is healthy. Good
ideas may stem from the discussion, so by all means, keep posting.
I
don't think you need a new built-in function called MinPos. Maybe TJ came up
with a solution the other day by suggesting you set the max open positions to
some large value like 10 of 15, even though you plan to take on no more than 5
at any time. So, if you don't use up all your equity using volatility-based
positionsizing, you might add on new positions with this approach. I haven't
tested this idea yet, but I will. The problem occurs when the opposite
happens, namely, all your equity is used up before you are able to add your
4th and 5th positions. Your suggestion to limit positionsize not to exceed any
more than 20% of equity may be the solution since it goes hand in hand with
the philosophy of money management. That is, do not allow any one position to
exceed, say, 10 or 15 percent of your equity. The Turtles did that, and I
think lots of traders do that, too. So, I see nothing wrong with that. Have
you coded this in AFL? I'm like Yuki: good with concepts buy lousy with
creative programming.
Al Venosa
danielwardadams
wrote:
After
thinking about this some more, I think all I've described is what could
be accomplished with two more built-in variables. MinPos could say you
want no less than some minimum number of positions (5 in my example) and
MaxPositionSize could say you want to allocate no more than X% of
capital to any one position (20% in my example).
Within these
constraints, your actual position sizing methond could be anything you
want.
I'm probably rambling .........
Dan
--- In amibroker@xxxxxxxxxxxxxxx,
"danielwardadams" <danielwardadams@xxxx>
wrote: > > Al & Anthony, > I've also seen the lower
returns for volatility based versus equal > equity position sizing in
the past and didn't know what to do about > it (assuming I wanted
more positions for more diversification). > > I'm not sure how
one would code it in .AFL, but would the following > represent a
reasonable compromise? > > (1) Start with an equal equity based
model based on, say, 5 > positions (position size = -20). So
each part of the pie equals 20% > of total equity. > (2)
Determine actual position size within each piece of the pie based
> on volatility based sizing. So, depending on your risk parameter,
one > might use only 17% of one piece of the pie, 13% of another
piece, and > 20%, 8%, and 11% of the other pieces. > (3)
Sum the used portions of the pie (in this case 17+13+20+8+11 = > 69%)
and see what you have left. 31% in case. > (4) Allocate the remaining
cash according to the equal equity model. > This means you get
one more 20% piece of pie and only have 11% cash > remaining.
> (5) Apply the above using your ATR based position sizing
recursively > until your cash is minimized. So if you only are
able to use 9% of > the piece of pie left in (4) you take the 11%
left from that piece > plus the 11% cash and you have 22% -- enough
for another position. So > in this case you end up with 7
positions and only 2% left in cash. > So your cash is minimized and
all your positions adhere to the ATR > based position sizing. >
> Like I say, I have no idea how to code it but intuitively it makes
> sense to me. > > Thoughts/comments? > >
Dan > > (And, yes, I'm sure I'm not the first person to think
of it so my > apologies to those who have gone before). >
> --- In amibroker@xxxxxxxxxxxxxxx,
"Anthony Faragasso" <ajf1111@xxxx> > wrote: >
> Hello Al, > > > > You stated: > > >
> "the lower the volatility, the lower the risk and therefore, the
> smaller the positionsize for that stock. " > > >
> Is this a correct assumption ? ...Would you want a larger >
positionsize on a less risk position , and a smaller position on a >
more volatile one ? > > > > Anthony >
> ----- Original Message ----- > >
From: Al Venosa > > To: amibroker@xxxxxxxxxxxxxxx
> > Sent: Saturday, December 11, 2004 7:53 AM >
> Subject: Re: [amibroker] PositionSize / Capital >
> > > > > Ed, > > >
> I, too, have confirmed many times with backtesting what you
> report, viz,, that positionsize = -x gives better performance
results > than using volatility-based MM positionsizing. The
non-MM code I've > used in the past is: > > >
> posqty = Optimize("posqty",5,2,10,1); // no. of stocks
active at > any given time > > PositionSize
= -100/posqty; //equal equity model > > > > I
think I know what the problem is, but I have not as yet figured >
out how to solve the problem with AFL. If you use the MM-based >
positionsize statement as we have discussed (equal volatility model),
> i.e., PositionSize = -1 * C/StopAmt, and examine the tradelist, you
> will likely discover that, often, not all 5 stocks are active all
the > time. In other words, either you have idle capital earning
nothing or > you have fewer active stocks than you want. Why is
this? Because some > stocks, which might not be as volatilie as
others, use up more of > your capital to initiate a position than a
more volatile stock. > Consequently, your capital is used up before
you have a chance to > enter into your 4th or 5th stock. Instead of
having 5 open positions, > you might only have 3 because of this.
Checking positionsize > shrinking doesn't help because you'll
discover you might have tiny > positions in your 5th stock. The fewer
stocks you have, the less > diversified you are, and therefore the
more risky your portfolio. The > more risk, the higher the DDs.
This problem cannot happen with the > equal equity model since all
positions are equal in size, by > definition. > > >
> One possible way around this might be to increase your
margin so > that equity is expanded enough to allow full funding
of all > positions. But, again, this also increases your risk.
Another way > might be dynamically setting your risk to fit the
volatility of each > stock individually (the lower the
volatility, the lower the risk and > therefore, the smaller the
positionsize for that stock). However, > this changes your model so
that you no longer have equal > volatility/equal risk (getting closer
to the equal equity model). So, > the problem remains unsolved
for the moment. I have not had time to > devote to cracking this
problem yet, but some day I hope to do this. > If you have any
ideas, I'm all ears. > > > > Al
Venosa > > > > > > ed nl wrote:
> > Thanks for your effort Al. It is very
clear, > > > > In one of my
earlier posts I posted > > > >
// money management block > > stopLoss =
Ref(bbb*ATR(20),-1); > > // trade
risk > > tr = IIf(Buy,(stopLoss /
BuyPrice),stopLoss / (ShortPrice + > stopLoss)); >
> // renormalisation coefficient >
> rc = 0.02 / tr; >
> // positionsize >
> PositionSize = rc * -100 > > >
> > > it actually gives the same result
as your: > > PositionSize = -2.0 *
IIf(Buy,BuyPrice,ShortPrice) / stopLoss >
> except for short positions. Exact the same it
would be if I > use: tr = IIf(Buy,(stopLoss / BuyPrice),stopLoss /
(ShortPrice)); > > > >
Unfortunatelly I do not get better results this way. Using just >
a simple PositionSize = -10 still gives somewhat better results. >
> > > > > > > rgds,
Ed > > > > >
> ----- Original Message -----
> > From: Al Venosa >
> To: amibroker@xxxxxxxxxxxxxxx
> > Sent: Saturday, December
11, 2004 4:19 AM > > Subject:
Re: [amibroker] PositionSize / Capital > > > > >
> ed nl wrote: > > >
> Al, > >
> > but how do you
implement the risk factor now? > > >
> ed >
> Ed: > > >
> Let us suppose you have established
your risk as 1% (i.e., > the maximum you are willing to lose on a
trade). Let us also suppose > your initial equity is $100,000.
So, if the stock you buy (or short) > goes down by the amount
based on your system, you lose only $1000, > keeping you in the game.
Now, let us say you defined your volatillty- > based stop in terms
of 2*ATR(20), which you incorrectly assigned to > the variable
TrailStopAmount. I say 'incorrectly' because the > TrailStop in AB
was designed to mimic the Chandelier exit, which is > basically a
profit target type of stock (it hangs down like a > chandelier from
the highest high since the trade was initiated, if > long). I don't
think you want the TrailStop to be your money > management stop.
Rather, the MM stop is the max stoploss, defined as: > >
> > StopAmt =
2*ATR(20); > >
ApplyStop(0,2,StopAmt,1); > > >
> So, if your stock declines by
2*ATR(20) from your entry, you > exit with a 1% loss. Let's take
an example. Stock A is selling for > $40/share. It's ATR(20) is
$1/shr or 2.5% of 40. Your stop amount is > 2*ATR(20), which is
$2/shr. How much stock do you buy? You simply > divide your risk,
$1000, by 2*1, which is 500 shares. This amounts to > an
investment of $40/shr * 500 shrs or $20,000. All of this can be >
coded in one simple line of AFL plus the 2 lines above defining the >
MM stoploss: > > > >
PositionSize = -1 * BuyPrice/StopAmt; > > >
> where -1 is 1% of current equity
(0.01 * 100,000 or $1000), > BuyPrice = $40/shr, and StopAmt is 2.
Keep in mind that a negative > sign means 1% of CURRENT equity, which
means compounded equity, not > just a constant initial equity of
$100,000. If you carry through the > above math with your
renormalization coefficient notation, you wind > up with the exact
same answer. > > > >
One more thing. When you place your order, assuming you are > trading
with EOD data, you do not know what the buyprice is until you >
buy the stock, which is the next day. So, what most traders do is >
base their positionsize on the closing price of the night before the
> entry. Therefore, to place an order in the evening to be filled in
> the morning at the open, your positionsize statement would actually
> be: > > > >
PositionSize = -1 * C/StopAmt; > > >
> where C is the closing price on the
night before you buy. So, > if you use the code
SetTradeDelays(1,1,1,1), then the above formula > is OK. However, if
you use SetTradeDelays(0,0,0,0), then you have to > ref the C
back a day. > > > >
This is probably more information than you were asking about, >
but I hope it helps. > > >
> Cheers, > > >
> Al Venosa > > >
> > > > > > > Check AmiBroker
web page at: > > http://www.amibroker.com/ > >
> > Check group FAQ at: > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > > >
> Yahoo! Groups Sponsor
>
>
ADVERTISEMENT >
>
> > >
> > > > >
> >
------------------------------------------------------------------ -- >
---------- > > Yahoo! Groups Links > >
> > a.. To visit your group on the web, go
to: > > http://groups.yahoo.com/group/amibroker/ >
> >
> b.. To unsubscribe from this group, send an
email to: > > amibroker-unsubscribe@xxxxxxxxxxxxxxx >
> >
> c.. Your use of Yahoo! Groups is subject to the
Yahoo! Terms of > Service.
Check
AmiBroker web page at: http://www.amibroker.com/
Check
group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Check AmiBroker web page at: http://www.amibroker.com/
Check
group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Sponsor |
ADVERTISEMENT
|
|
|
Yahoo! Groups Links
|
|