PureBytes Links
Trading Reference Links
|
I always enjoy threads on my favorite topic, MM. Much of what Pal says
regarding position sizing is true (I will not comment on the returns),
and I am a staunch advocate of volatility-based MM techniques. However,
I have never been able to get MM algorithms to work properly using afl.
Let me give an example with coding. Suppose you want to trade a
portfolio of 5 stocks all the time, and all 5 stocks are entered and
exited at the same time (except for when one or more exits due to the
max stoploss being hit). Suppose also that, using MM techniques, your
stop is n*ATR(m) away from the BuyPrice or ShortPrice (we'll confine
this discussion to long only to keep things simple), where n and m are
optimizable parameters, the m being a function of the nature of your
trading system (long term or short term) and the n being a function of
your risk tolerance (the number of ATRs away from the entry price at
which you will exit to preserve capital). Now, let's compare afl codes
to compare 2 different MM position sizing scenarios:
The comparison is made using the same stoploss code and the same entry
and exit codes (whatever they may be):
SetOption("InitialEquity", 100000); // initial equity is $100,000
n = Optimize("n", 2, 0.5, 4, 0.25); // ATR multiplier to determine MM
exit based on volatility
ApplyStop(0, 2, n*ATR(m), true, false); // MM stoploss
PosQty = Optimize("PosQty", 5, 2, 15, 1); in this example, the default
is set to 5 positions in the portfolio.
Scenario I: Equal Equity Model:
PositionSize = -100/posqty; // $20,000 per stock initially
Scenario II: Volatility-Based Model:
PositionSize = -x * BuyPrice/(n*ATR(m)); where x is your pre-defined
risk as a percentage of current equity
In Scenario I, you are taking 5 equal positions regardless of what each
stock's volatility is. Thus, the position size for each portfolio trade
is exactly $20,000 per stock. Of course, this will grow as equity grows.
In Scenario II, x represents the risk you are willing to take on each
trade. If your risk tolerance per stock is, say, 1%, then you will lose
$1,000 per stock or $5,000 total if all 5 stocks decline by n*ATR(m). If
one stock has a very low volatility, then you will buy more of it than
another stock whose volatility is high, since ATR(m) is in the
denominator. Thus, for example if Stock A's volatility is 3% of its
price and its price is $30/share and you have determined by optimization
that n = 2, then the amount you will buy of that particular stock is
1000 * 30/(2 * 0.9) or $16,666. If Stock B's volatility is only 1% of
its price and its price is also $30/share, then the amount of Stock B
you will buy is 1000 * 30/(2*0.3) or $50,000. And so on for the other 3
stocks.
Do you see the problem with this? One stock, due to its low volatility,
is requiring that you commit 50% of your portfolio to that stock alone.
What happens in backtesting is that much of the time, you run out of
capital when backtesting the above such that you don't always invest in
all 5 stocks (positionsize shrinking is always turned on) or maybe
you'll buy 4 stocks and only enough capital is left to commit a very
small amount to it). You might even see only 2 stocks being traded,
since their volatility might be so low at that particular time that you
are forced to commit most of your capital to those 2 stocks. The
consequence of this, besides reduced diversification, is that Scenario
II never backtests nearly as well as the simpler Scenario I. If you
reduce your risk to something less than 1% in order to enable you to get
all 5 stocks traded all the time, then much of the time you won't even
commit the entire equity. In that case, Scenario I substantially
outshines Scenario II since Scenario II does not commit all of one's
trading resources to each trade, and the resulting compounding suffers
substantially in comparison to Scenario I.
As I stated in the first paragraph, I am an advocate of volatility-based
MM techniques, but unfortunately I have been unsuccessful in devising
the proper afl code to take advantage of this important strategy.
Perhaps someone on this group will recognize the error of my ways and
lead me on the proper path. Thanks in advance if you do.
Regards,
Al Venosa
>
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
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/
|