24h購物| | PChome| 登入
2011-04-15 13:52:18| 人氣1,513| 回應0 | 上一篇 | 下一篇

止損不是孤立的

推薦 0 收藏 0 轉貼0 訂閱站台

止損不是孤立的

凡是作期獲的,都知道止損。 對於止損,可謂仁者見仁,智者見智,甚至有些“大師”對止損根本不屑一顧。每次看到這些“大師”,我就想起一則關於鸚鵡的故事。故事是這樣的:有一人第一次坐飛機,找乘務員要杯水,好長時間過去了,也沒看到乘務員回來。就在這時,忽聽,身後有人大聲喊叫,並滿嘴髒話,回頭一看,原來是只鸚鵡,只見乘務員畢恭畢敬,忙前忙後。他想原來這樣管用,於是,他也學鸚鵡的樣子,大聲喊叫、滿口髒話“給我拿杯水來,你們XXX”,果然,一名乘務員趕緊跑過來,畢恭畢敬問道:“先生,請問是您要杯水嗎?”“對,XXX”“請您稍等,馬上就來。”過了一會兒,那名乘務員和一名壯漢來到他面前,乘務員一指“就是他”,於是,他被壯漢扔出了飛機。正在他郁悶的時候,他看到剛才那只鸚鵡也被扔出了飛機。鸚鵡在飛過他身邊的時候說了句:“你又沒翅膀,也敢瞎牛X。”  我想“大師”都是有翅膀的。我沒有翅膀,所以我必須定止損。  止損是在你開倉之後,為了防止市場的不測(實際是自己判斷失誤),為了不至於產生更大的損失而設定的。所以,止損不是孤立的,而是和開倉、手數及你能承受的單筆最大損失密切相關的,是你的整個交易系統中的一部分。  以某商品為例:我認為某月某日給出了下跌信號,準備隔日建空單。  首先,我認為如果某商品再漲到2680,下跌信號不成立,為了防止騙線,將出場點位放在2690;其次,我能承受的單筆最大損失是10000元。於是,我有2種方案可供選擇:

 1、  我如果在2640放空,我的最大手數是較少手;

 2、  如果我想放空更多手,則我的開倉點位應在2665。

 (不含交易手續費)

 一個好的交易系統不應該只是分立的包含技術形態分析、設定止損和資金管理,而應該是三者的一個有機的結合體。

The Basics of Money Management II

In the previous article1 we’ve defined money management as a part of a trading strategy that defines the risk that should be taken at opening a position and the size of the position to be maintained at a given moment relative to the capital. In the present article some of the popular money management methods are going to be reviewed.

 

A dictionary of money management

Money Management Mathematical expectation of profit –

the sum of profit probabilities multiplied by the size of those profits minus the sum of loss probabilities multiplied by the size of those losses

Ε = S

The mathematical expectation may be roughly estimated as the profit probability (%Win/100), multiplied by average profit (AvgWin), minus loss probability (%Loss/100), multiplied by the average loss (AvgLoss). – the sum we are ready to lose before exiting an unprofitable trade per one share (contract). The difference between the entry point an the exit at a loss point.

 

Initial risk Current (open) risk

Martingale – Antimartingale – Volatility

– the measure of the extent of price changes per a given period of time.increasing the position size as the capital increases.– the difference between the current price and the exit point. increasing the position size as the capital decreases.
i(Probability of profiti * Profiti ) - S j(Probability of lossj * Lossj )– part of a trading strategy that defines the risk that should be taken at opening a position and the size of the position to be maintained at a given moment relative to the capital.

Evidently, if we put too little at the stake, we won’t cover our expenditures of time, energy and beer, too. It is much less evident, yet so, that if we start betting too much, sooner or later we are going to lose the entire capital. Economical theories and common sense both keep telling us that the higher the risk, the more the profit. This statement is untrue: the dependece between risk and profit is non-linear.

Let us imagine there are only two outcomes in our treading: losing the bet wit ha probability 100 - PctWin, or winning WinToLoss * bet size with a probability PctWin. In this case the mathematical expectation will be:

Expectancy = PctWin * 0.01 * WinToLoss - (1 - PctWin * 0.01)

Suppose that the PctWin and WinToLoss parameters are set and we can only control the bet size. Let us then review the dependence between profit and bet size after 100 trades with different PctWin and WinToLoss values using Monte Carlo modeling. To do this we repeat over and over 100-trade series for every combination of the bet size, PctWin, WinToLoss parameters. The exact outcome (profit or loss) will be determined by a random number generator.

Here is an example of implementing Monte Carlo methods in TradeStation (the code for the corresponding TradeStation signal is shown in Appendix 1). Copy it to PowerEditor, create in StrategyBuilder a strategy with this signal, apply it to any plot and launch parameter optimization in TradeStation as shown below.

Ill.1

This strategy will save to a file the profit for all combinations of parameters and random trade outcomes. One should keep in mind that the number of bars multiplied by the number of combinations mustn’t exceed 65536 (the maximal number of lines in an Excel file). The Random(100) function will generate an uniformly distributed random value between 1 and 100. Then the PctWin-Random will define with a PctWin probability whether the given trade brings profit or loss, and the profit size will be equal to WinToLoss.

Then we can plot in Excel the plots indicating the profit for the given parameters. For example, let us recall the game played by scientists from the previous article, where the bet won in 60% of cases and lost in 40%. To plot the dependence between average profit and bet size in that game, we must:

    • Launch in TradeStation an optimization of a strategy by the PctRisk parameter = 5, 10, …, 90 with constant PctWin = 60%, WinToLoss = 1;
    • Open in Excel the file D:\TS_Export\MTrading_MMII.csv;
    • Enter the values of the parameters to be optimized in column F and the following formulas in column G:

=SUMIF (A$1:A$20860,"=5",E$1:E$20860)/COUNTIF (A$1:A$20860,"=5")

=SUMIF (A$1:A$20860,"=10",E$1:E$20860)/COUNTIF (A$1:A$20860,"=10")

etc.

We then will see a plot like shown in Ill. 2.

The shape and values of the curve may differ somewhat in different runs, since random values are random, but the profit will invariably first rise and then descend as the risk grows.

All the multitude of money management algorithms may be divided in two principal classes: martingale and antimartingale.

Martingale methods state that the risk should increase as the capital decreases. These methods are popular with traders trying to extract profit from a series of losses.

Let us review an application of martingale in roulette. We bet 1$ on a color and every time we lose, we double the bet. Next time after we win, we start at 1$ again. If we lose 10 times in a row, which may happen with a probability of (19/37)^10 or 0,13%, we’ll have to bet $1024 to win $1. Since in such a case the expected profit/risk ratio is disastrously low, it is often supposed that martingale methods may not be used in trading. But, one should keep in mind that in popular trend-following methods

But, one should be well aware that in popular trend-following methods

1) profits are usually 2-3 times larger than losses

2) series of small losses are typically interspersed with large profits

So martingale methods in our opinion deserve a serious study.

Antimartingale methods state the direct opposite: the risk size should be increased as the capital grows and decreased as the capital decreases.

The known antimartingale methods advise to risk a fixed fraction of the capital (fixed fractional):

    • Trade a constant number of stocks – with some conditions this method can be considered an antimartingale;
    • Use the whole accessible capital;
    • Trade one lot per X dollars on account;
    • Divide the account into equal shares corresponding to the assets traded;
    • Risk a part of the capital;
    • Take the risk in proportion to the traded assets’ volatility;
    • Use the Kelly method, optimal f anf their variants.

The fixed ratio method by Ryan Jones can also be considered antimartingale. This method states that the relation of the number of stocks traded to the capital gain necessary to increase the number of stocks should remain constant. Ryan Jones was so sure of his method’s advantages that last year he resolved to break the World Trading Cup record of Larry Williams standing since 1987. Williams then increased this capital from $10,000 to $1,147 000 in a year of real S&P and T-Bonds trading. Ryan Jones didn’t make it to 2000 year winners, but at May 31, 2001 he was a sure leader with a +226% result.

A positive aspect of antimartingale methods is that they allow the account to grow in geometrical progression.

The most popular method of money management is no money management. There are three variants of it:

1.  Money management for gamblers

This method includes betting on a single trade all the accessible capital wit the maximal allowable leverage. No matter what the result, close the account and leave either with 100% loss or with a profit equal to

Recommended for newbies wishing for quick profits. This method is especially good when using a leverage of 1:100and higher: in the absence of a strategy with a positive mathematical expectation this method is optimal. The most important in this method is understanding that the strategy is used once, as luck only is exploited, not statistical advantage, which according to the law of large numbers can come true only in a large series of profits and losses.

2.  Fixed number of lots

This method states: independent of the account state, always enter the position with the same (usually an even) number of lots.

Let’s apply this method to the simplest model system known as the “dynamic channel”: Buy one lot if the average day price ((high + low)/2) grows over its minimum by X points;

The code for this system with those algorithms is shown in Appendix 2.

The results of trading a fixed number of lots with $100000 starting capital and 0.66 margin are shown in Table 1 (here and below the results are taken from TradeStation Strategy Performance Reports).

Table 1. Fixed number of lots, simplest system.

Sell one lot, if the average day price ((high + low)/2 falls under its maximum by X points;

Subtract $1 from every trade to account for commissions and slippage.

(Leverage *Profit_ in_ points *Price_ of_ a_ point /Initial_ deposit_ size – 1) * 365 / Days_in_position

% per year.

Number of lots

Net profit

Avg. profit/Avg. loss

Average trade

Maximal drawdown

Profit factor

100

33180

1.78

141.2

-41140

1.185

200

66360

1.78

282.4

-82280

1.185

Let us remark that a further increase of lots activates an implicit antimartingale money management in one direction: we cannot open positions larger than our current capital, so if the capital dectreases, so will the position size. When capital grows, the position size will remain constant. So let us redefine the method as follows: independent of the account size, always enter the position with the same (usually even) number of lots, if the current capital allows that; otherwise enter the position with the maximal possible number of lots.

Although this method is fairy safe, it does not allow the account to grow in geometrical progression, so we do not recommend using it.

3.  «Bet it all»

This method states: use all the available resources when opening a position.

In other words, w open the maximal possible position every time.

Let us review how results of this method depend on the leverage with the starting capital of $100000 (table 2).

 Table 2. Results of leverages when trading the whole capital

Own capital/

invested assets

Net profit

Avg. profit/

Avg.loss

Average trade

Maximal drawdown

Profit factor

0.5

-55586

1.49

-236.5

-1836149

0.993

0.6

28734

1.51

122.3

-2064980

1.003

0.7

111598

1.52

474.9

-1921994

1.015

0.8

170958

1.54

727.5

-1643650

1.027

0.9

207034

1.56

881.0

-1370108

1.041

1

225194

1.58

958.3

-1136433

1.054

 As you can see, even losing just 4 cents per share in a trade when our strategy is profitable, with a 2:1 or larger leverage we eventually lose the entire capital!

This method increases risk without an adequate increase of profit, so we cannot recommend using it.

4.  Number of lots per fixed sum of money3

This metod states: trade one lot per every X dollars on account:

 Number of lots = Capital

/ Х_ dollars

$ per 1 lot

Net profit

Avg. profit/Avg. loss

Average trade

Maximal drawdown

Profit factor

300

-11042

1.49

-46.9

-701498

0.996

400

12484

1.51

53.1

-426394

1.007

500

27416

1.53

116.7

-306616

1.021

600

31244

1.55

133.0

-229446

1.033

700

34707

1.57

147.7

-184482

1.046

800

35460

1.59

150.9

-152288

1.057

900

35231

1.60

149.9

-128847

1.067

1000

34161

1.61

145.4

-110798

1.076

 
The problem with the given method is that not all papers are equal: one lot of AAA shares (100 shares) would be quite different in its cost and volatility from a lot of BBB shares (1 share). AAA’s volatility is, say, 20% of BBB’s, and the behavior of a pjrtfolio composed of those two stocks will be 80% influenced by BBB and 20% by AAA.

Another problem common for all antimartingale methods is that the position size grows without a direct proportion to the capital gain. I.e. if we have a starting capital of $100 000 and buy one lot per $1000, we must increase our account to $101000 to increase the position size by one unit. Yet if our capital is $1 000 000 we must increase the account to $1001000 to increase the position size by one unit (just 0.1%). So the account grows much slower with a small starting capital.

The method’s advantage is that a trade will never be rejected as being too risky – but again, in some cases this may turn out to be a disadvantage.

5.  Equal parts

This is a popular trading method that states to divide the capital in equal parts according to the number of assets traded.:

 Number of lots = Capital / (numer_assets * price_of_asset)

 This method assigns an equal weight to all papers in the portfolio and so avoids the previous’ disadvantage. For instance, with $100000 on the account and trading 6 shares without a leverage, we could buy 15 lots of AAA and 50 lots of BBB. Yet the disproportion between the position growth and capital growth in this method persists.

 6. Percentage of risk

entry point and the stop-loss exit, multiplied by the number of lots. The method states that the initial risk for the position should be equal to a fixed fraction of the capital:

 Number of lots = % risk * Capital / initial_risk_per_unit_of_assets

 For instance, we have a capital of $100000 and do not wish to risk more than 1% of it per trade, i.e. $1000. The simple trading system reviewed here generates a signal to pen a position in the other direction as soon as the average day price deviates from its extreme value by 4 cents or more. This defines o as $4 per lot (100 shares*$0.04) which limits our position size to 250 lots.

Table 4 lists an example of using the “% of risk” method with different parts of the capital in percents at risk (initial capital $100000, margin 0.66)

 

The risk per unit of assets shall be defined as the absolute difference between position

% risk

Net profit

Avg. Profit/

Avg.loss

Average trade

Maximal drawdown

Profit factor

0.1

11649

1.73

49.6

-18308

1.151

0.2

21838

1.68

92.9

-43026

1.123

0.3

29369

1.65

125.0

-73955

1.097

0.4

34161

1.61

145.4

-110798

1.076

0.5

35460

1.59

150.9

-152288

1.057

0.6

34017

1.56

144.8

-197807

1.042

0.7

29459

1.54

125.4

-245598

1.028

0.8

21939

1.53

93.4

-293086

1.017

0.9

12231

1.51

52.0

-339099

1.008

1

600

1.50

2.6

-403935

1.000

So with a risk of over 1% we’d get into negative figures. Betting a set percent of the capital, against our expectations, did not bring any substantial improvement. This can be explained by the fact that the level of the price correction in relation to extreme value (and consequently the risk) has been expressed in absolute values instead of relative. So next we try to change the system rules to:

Buy 1 lot if the day average price ((high + low)/2) grows by X percents or volatility units above its maximum.

Sell 1 lot, if day average price ((high + low)/2) falls by X percents or volatility units under its maximum.We suppose this may produce a major improvement in relation to the previous methods and leave the idea for the readers to explore.

 7. Percent of volatility.

Volatility is a measure of the prices’ movement for a certain period of time. It can be described by various means, among which the most frequently used is the average range

Volatility = Average(Range, Period),

Average true range ATR (an in-built TradeStation function AvgTrueRange) by W. Wilder,

or historic volatility

HistVolatility = 100 *StdDev(Log(Close / Close[1], Period) * SquareRoot(365).

The method states to set a volatility for every position in relation to a fixed fraction of the capital:

Number of lots = % volatility * Capital / Asset_volatility

For instance, we have a capital of $ 100000 and wish to buy AAA stocks. The average true range for several days was $0.1 or $10 per lot. If we limit the volatility of our account to 10%, then we can buy a maximum of 1000 lots. Thus we can control the possible fluctuations of every element of the portfolio.

Let us apply thepercent-of-volatility method to the same conditions (stock trading with a starting capital of $100000 and a 0.66 margin). We advise you to get ready for a shock as you read the next Table 5.

 

% of volatility

Net profit

Avg. profit/

Avg. loss

Average trade

Maximal drawdown

Profit factor

1

161683

2.11

688.0

-83663

1.407

2

431088

1.90

1834.4

-389217

1.268

3

764100

1.76

3251.5

-1118840

1.175

4

1049214

1.67

4464.7

-2420524

1.113

5

1155627

1.61

4917.6

-4214557

1.070

6

1017980

1.56

4331.8

-6088767

1.041

7

691490

1.53

2942.5

-7407768

1.022

8

317292

1.51

1350.2

-7595240

1.009

9

33120

1.50

140.9

-6488492

1.001

10

-101592

1.53

-439.8

-5948430

0.997

 Compared to trading 100 fixed lots the net profit (with 1% volatility) increased almost five-fold while the maximal drawdown only doubled. The relation of avg. profit to avg. loss and the profit factor increased by 19%. With 5% volatility the net profit for the same trades increased 35 times!

We can also limit the overall volatility for the whole portfolio for the given moment. For instance, if we limit the portfolio volatility to 10% and the volatility for separate positions to 2%, we can simultaneously open positions in 5 stocks.

The percent of risk and percent of volatility methods may be used as filters to detect and reject trades with a high risk.

Speaking of the antimartingale methodsadvantages in general, we can make the following conclusions:

While risking a larger part of the capital, we allow the account to grow in geometrical progression.

     

  1. Risking a small part of the capital, we protect the account from significant damage.

     

    Concerning the general disadvantages of antimartingale methods, we can conclude that:

    Risking a larger part of the capital, we are prone to large losses.

     

  2. Risking a small part of the capital, we do not allow the capital to grow quickly.

     

     3.The positions grow disproportionally to the capital growth.

 

Next time we are going to discuss the newer and more efficient methods of money management including the Fixed Ratio, the optimal f and the algorithm used by Larry Williams for his record-breaking achievement.

{****************************************************

Monte-Carlo Simulation Signal.

Copyright (c) 2001 DT

****************************************************}

Inputs: PctRisk(10), {% риска от текущего капитала, 0-100}

PctWin(50), {% выигрышей, 0-100}

WinToLoss(2) {отношение выигрыш/проигрыш};

Vars: Win(0), Count(0), Expectancy(0), Equity(1), Str("");

if CurrentBar = 1 then FileDelete("D:\TS_Export\MTrading_MMII.csv");

Expectancy = 0.01 * PctWin * WinToLoss - (1 - PctWin * 0.01);

if Expectancy > 0 then begin

Equity = 1;

for count = 1 to 100 begin

value1 = Random(100);

if PctWin - value1 > 0 then

Win = WinToLoss else

Win = -1;

Equity = Equity * (1 + PctRisk * 0.01 * Win);

end;

Str = NumToStr(PctRisk, 0) + "," + NumToStr(PctWin, 0) + "," + NumToStr(WinToLoss, 2) + "," + NumToStr(Expectancy, 2) + "," + NumToStr(Equity - 1, 2) + NewLine;

FileAppend("D:\TS_Export\MTrading_MMII.csv", Str);

end;

Appendix 1.


 

{****************************************************

The Simplest System #2 with Money Management.

Copyright (c) 2001 DT

****************************************************}

 

Input: Price((H+L)*.5), PtUp(4.), PtDn(4.);

Inputs: MM_Model(0), {0 = MM absence, 1 = MM for gamblers; 2 = MM units per fixed money; 3 = Equal Units; 4 = % Risk; 5 = % Volatility}

MM(10), {MM parameter}

InitCapital(100000), {Initial capital to trade}

Marg(.66); {Margin percentage}

 

Vars: MP(0), Risk(0), Num(1), Equity(0), OpenAssuredProfit(0);

Vars: WinP(0),AvgW(0),AvgL(0), Kelly(0);

Vars: Marg1(0), {Margin}

Lots(0), {Number lots in a margin, determined by Delta}

Equity_0(0), {Initial capital to trade one lot}

FRDelta(0);

Vars: LL(99999), HH(0), Trend(0), Volat(TrueRange);

 

MP = MarketPosition;

Volat = .5 * TrueRange + .5*Volat[1];

 

if MP <= 0 then begin

if Price < LL then LL = Price;

if Price cross above LL + PtUp*.01* BigPointValue then begin

Trend = 1;

HH = Price;

end;

end;

if MP >= 0 then begin

if Price > HH then HH = Price;

if Price cross below HH - PtDn*.01* BigPointValue then begin

Trend = -1;

LL = Price;

end;

end;

 

If trend = 1 then Risk = PtDn {+ Slippage};

If trend = -1 then Risk = PtUp {+ Slippage};

 OpenAssuredProfit = MaxList((Trend*(close - EntryPrice) - Risk)*Num, 0);

Equity = (InitCapital + NetProfit + OpenAssuredProfit); {Reduced Total Equity}

 

if MM_Model = 0 then { Equal lots}

Num = MM;

 

if MM_Model = 1 then { All Resources}

Num = Floor(Equity/Marg/close);

 

if MM_Model = 2 then { MM Units per Fixed Money }

Num = Floor(Equity/Marg/MM);

 

if MM_Model = 3 then { MM Equal Units }

Num = Floor(Equity/Marg/close/MM);

 

if MM_Model = 4 then { % Risk Model }

if Risk <> 0 then

Num = floor(MM*Equity *.01/Risk/Marg);

 if MM_Model = 5 then { % Volatility Model }

if Volat <> 0 then

Num = floor(MM*Equity *.01/Volat/BigPointValue/Marg);

 if Num < 1 then Num = 1;

if Num > Equity/close/Marg then Num = Equity/close/Marg;

 { Entries}

if trend = 1 and trend[1] <> 1 then buy("LE") num contracts at market;

if trend = -1 and trend[1] <> -1 then sell("SE") num contracts at market;

 

Appendix 2.

For instance, if we’re trading one lot per$1000, then, if we have $100000 on account, then we can trade 100 lots.

The table 3 lists an example of trading with different sums reserved for trading on lot (starting capital again $100000 and margin 0.66)

Table 3. Results for trading a number of lots per fixed sum of money.

The Basics of Money Management III

Let us continue reviewing the modern methods of money management. All the methods described below are antimarthingale, i.e. they increase the risk size as capital size grows and decrease it as capital shrinks and involve risking a fixed fractional.

For instance, we have a maximal set drawdown in % of the capital. The method involves equaling the starting risk for the position to a fixed fraction of the set maximal drawdown:

 

Num_Lots = % Risk * (Capital – (1 – Max_%_Drawdown) *

Maximal_Capital) / starting_risk_per_unit_assets / 100.

If our current capital is $100 000, maximal reached capital $110 000 and maximal allowable drawdown 20%, we can risk a sum equal to 10% of the drawdown. Then our risk would be $1200 (10% * ($ 100 000 – 80% * $110 000)). Thus, if the risk per share is $0.1, we can buy 120 lots of 100 shares. If price changes were uninterrupted, transaction costs negligible, odd lots permitted and the traders’ timing perfect, then this method would guarantee tha drawdown never goes over the limit.

Another option of drawdown control is taking into account its maximal historical value

(with a fair reserve):

Num_contracts = Capital / (2 * Max_Drawdown + margin_per_contract)

Kelly’s method

This method defines the optimal percent of risk that should be employed to maximalise the “usefulness” function presented as logarithm of the capital. Relatively to gambling and further, to stock trading was developed by professor Edward Thorpe3.

In the trading game of doctors of sciences described in the previous article (where 60% of cases won and 40% lost the bet), the optimal bet according to Kelly is 20% of current capital. From Table 3 of that article we can see that the 50-percentile k-50 really reaches its maximum of 7940 when the stake is 20%. What’s not so smooth-looking is that 50% of drawdowns are over 79.09$ and the maximal drawdown reaches 99.43%. Are we willing to reach the maximal possible profit at the cost of losing 99% of the capital somewhere along the way? If we want to break the record of Larry Williams, then maybe so. As Ralph Vince explained that achievement: “He is one of the few persons really able to trade with fully optimal values and pass through the concomitant drawdowns” .

Kelly’ s method defines the percent of risk as^

Kelly%=%win – %loss * Avg_profit / Avg_loss

Hence we can estimate the position size:

Num_Lots = Kelly% * Capital / starting_risk_per_unity_of_assets

Thorpe recommends using % of risk within 0.5 * Kelly <= % risk < Kelly bounds. Table 1 shows the results that allow us to conclude that with risks 18% of Kelly and more our simple trading system is no longer profitable.

Table 1. Results of testing Kelly’s method

%risk* Kelly

Net Profit

Avg. profit/ Avg.loss

Avg. trade

Maximal drawdown

Profit factor

4

731586.50

1.8916

3870.828

-1004958

1.2445

6

1386439.00

1.728

7335.6561

-3618084

1.1368

8

1876666.00

1.6285

9929.4497

-9506103

1.0714

10

1814372.00

1.5704

9599.8519

-19437432

1.0332

12

1164496.00

1.5394

6161.3545

-31176880

1.0127

14

451504.00

1.5252

2388.9101

-42140292

1.0034

16

23984.00

1.5202

126.8995

-50536160

1.0001

18

-94656.00

1.5191

-500.8254

-61471408

 Optimal f.

 

TWR à Max 0

where

TWR = P i=1,..,n (1 – f * Trade_resulti / Max_loss)

We take the negative value of the loss, hence the minus. Actually, this method implies that in the future the trade results will be about the same, but possibly in another order. Solving the TWR maximization, we find the f = fopt value, where the TWR function reaches its maximum. From fopt we define position size:

Number_Lots = fopt * Capital / ( - Max_Loss)

A simple method of calculation is presented in App. 2. According to it the maximal drawdown with optimal f value will be at least fopt % of account. I.e. if our fopt is, say, 0.5, then our drawdowns will reach at least 50%. Raplh Vince says that: ”if you are not trading for optimal profits, then you belong in an asylum, not in the market”. Still, he does not consider the fact that a 99% drawdown when trading for an “optimal profit” can land us in asulym – or at least in hospital after trying to explain to the family or investors. It doesn’t help that the capital grows on then.

Besides, the distribution of trade results has a most profound influence on the fopt value. So fopt values for two strategies that in the end bring the same profit and have the same maximal loss may be very different.

The weak spot of the optimal f method is that it is fully based on the system’s historical results, on maximal loss to be exact. The risk level set when using fopt, means we‘ll never have a larger loss.

Unlike gambling, where the outcomes are known and probabilities constant, in trading we have a multitude of random outcomes with undetermined probability of winning. The maximal loss is a nondescreasing step function, with random amplitude leaps occurring at random moments.

So, there is no real evidence to suppose that the maximal loss and maximal drawdown achieved will persist in the future. To calculate fopt it is possible to use in the TWR formula, instead of the maximal loss a value:

Max_Loss_Evaluation = Avg_Loss – 3.5 Standart_Deviation_of_Loss

But this doesn’t solve the problem yet. The outcome of a future trade is evidently random, so then the optimal f for is must also be random. The fopt value calculated from previous trades won't be really optimal for future trades, unless we turn to really reckless trading. Let's show an example of this.

We calculate the optimal f for a model system (num = 1) for several trades in a row, as shown in App.1. For the last 10 trades the optimal values would be 0.135, 0.134, 0.131, 0.123, 0.156, 0.142, 0.149, 0.137, 0.155, 0.165. So before the last trade we choose a value of f equal to 0.155 while the optimal value would be 0.165 – we take a less-than-optimal risk. Even worse, the third trade from the right has an optimal f of 0.137, while we consider it to be 0.149, accepting too much risk. So the so-called optimal f is really far from optimal.

The Safe f

TWR à Max 0

If

Max_Drawdown <= Max_Allowed_Drawdown

Another way is to use the maximal drawdown or its estimate instead of the maximal loss in the TWR formula for calculations the safe f.

Optimal f with volatility. Murray Ruggiero proposed to adapt the position size calculated using the optimal f to the current market volatility.. This is founded on the hypothesis that when the market volatility is low, the chance of having a large loss is larger than when the volatility is high. We normalize the volatility from 1 to 0, where 0 is maximal volatility, and 1 – minimal:

Volatilitynorm = (Max_Volatility – Current_Volatility / (Max_Volatility – Min_Volatility)

Then

Num_Lots = fopt * Volatilitynorm * Capital /

( -Max_Loss_Estimate)

Here the, fopt is calculated also using the maximal loss evaluation.Fixed Ratio

. A common problem of all methods using a fixed fraction of the capital is that different methods either maximize the capital growth without relation to risk (i.e. the optimal f) or minimize the risk (i.e. risking not more than x% of capital). Trying to solve this conflict Ryan Jones concludes that the relation of the number of lots traded to capital growth needed to increase the number of lots by one (or the minimal increment) should be a constant8:

Previous_Capital+Num_Lots * Delta = Next_Capital

Where Delta defines how aggressive or conservatiove is our application of money management: the more Delta, the larger profit per lot need we receive to increase the number of lots traded. The author proposes using as Delta a part of the maximal drawdown. Our experiments show it’s much better to use volatility.

Table 3 lists the results of testing a basic system with the Jones’ algorithm and Delta proportional to volatility. The method is unprofitable with small Delta values, then leaps to maximal profits, after which both profit and maximal drawdown monotonously decrease as Delta grows.

Table 3. The results of testing the fixed ratio method.

. Leo Zamansky and David Stendahl tried to overcome large drawdowns by adding a special limit of maximall allowable drawdown: This method of estimating the optimal % of risk has been improved by Raplh Vince. While Kelly’s formula use only average values from past trades, Raplh Vince proposed to take into account all trades, solving the task of optimization of the relative end capital TWR as a function of f.

Delta=% of volatility

Net Profit

Avg. profit/ Avg.loss

Avg. trade

Maximal drawdown

Profit factor

1

-102156.06

0.7991

-540.5083

-105916.3

0.5258

2

1020734.25

1.9748

5400.7103

-1089653.8

1.2992

3

815346.50

2.0056

4314.0026

-797624.75

1.3195

4

685600.13

2.0238

3627.5139

-636779.13

1.3314

5

597519.38

2.0366

3161.4782

-534939.63

1.3399

6

533938.38

2.0469

2825.0708

-464201.44

1.3466

7

485445.13

2.0552

2568.4927

-412132.94

1.3521

8

446773.25

2.0621

2363.8796

-371874.88

1.3566

Таблица 3. Результаты тестирования метода фиксированного отношения.

The idea behind this method looks quite doubtful: increasing the number of lots traded from one to two is not equivalent to increasing the number from 10 to 11 (as states Ryan Jones), and an increase from 10 to 20 is a 100% increase. The trader is concerned not about the quantity of contracts, but capital growth and risk in relative values.

Let us perform some manipulations according to Ryan Jones. With a few mathematical transformations (see App.3) we make an expression:

Num_Lots = 0.5 + (2 * Profit/Delta + 0.25)^(0.5).

So the number of lots in fixed ratio trading is proportional to the square root of the capital. All variants of fixed ratio trading define the number of lots traded as depending on the capital linearly. Anyone familiar with the basics of mathematical analysis know that at low X values

y = a * x^(0.5) is larger than the linear y = a * x, and vice versa at high X values (see Ill. 1). Hence with a small capital the fixed relation method prescribes trading a larger number of lots than the fixed share of capital, and a smaller number of lots with a larger capital. In other words, the fixed ratio method recommends higher risks with small capitals than the so-called “risky methods” criticized. Practically, this “new” method also involves risking a fixed part of the capital, in a more aggressive way compared to the original. The book examples showing the advantages have been skillfully selected so that drawdowns occur only after the capital has grown significantly.


Ill. 1. Comparison of function values with different arguments.

As to Ryan Jones’ attempt to break the trading record of Larry Williams in The Robbins 2001 Futures Trading Contest described in the previous article, he failed again... After his account grew by 600% from $15 000 to $107 000, he sent an offer to buy his method, proven by statements capable to bring such profits. Besides, he offered a $299 per month subscription to stay informed of all trades taken in the contest. As a result the drawdown on his capital reached 95%, just what had to be proven. The method of Larry Williams.

$210000, then dropped to $700 000 (67% drawdown) and the year was finished at $1100000. By the way, Ralph Wince was working for Williams as programmer. Now Larry Williams recommends the following varian of the fixed fraction method:

Num_Lots = % risk * Capital / (- Max_Drawdown) / 100.Playing the “market’s money”.

As experience shows, for an investor it is much more important not to lose a small part of the starting capital than to lose a substantial part of the profits. The idea is taking smaller risks on starting capital and larger, more aggressive on profits received:

Num_Lots = (%riskstart_capital) * (Starting_Capital + MinList(Profit, 0)) + %riskprofit * MaxList(Profit, 0)) / starting_risk_per_unit_of_assets / 100.Pyramid building

Effective_Risk = MarketPosition * (Entry_Price – Current_Exit_Price) *

Num_Lots * Price_of_a_Point

where MarketPosition equals 1 for long positoins, -1 for short, 0 for no position. Until the trade has no unrealized (paper) profit, the effective risk is positive. A trade protected by a stop-loss order at breakeven level has zero effective risk. As soon as the stop loss is moved past breakeven level, the effective risk becomes negative – which means the position has a guaranteed profit, protected by the stop loss. The capital is no longer subject to risk, so we can risk the guaranteed profit, increasing the position size correspondingly.

 

Additional_Number_Lots = % risk_guaranteed_profit *

(- MinList(Effective_Risk, 0)) / starting_risk_per_unit_of_assets / 100

Here MinList( ) is the least value from the list.

Let us now see it all on an example. If we reinvest the guaranteed profits with the same risk, then, as Table 4 shows, profits will increase over 4 times and drawdowns 2.8 times. If we increase the risk for guaranteed profits, net profit skyrockets – but unhappily, drawdowns increase even more.

Table 4. Reinvesting the guaranteed profits.

. All the methods described above define the starting risk for opening the position. The current or effective risk of an open position is, actually, different. It may be expressed as: During his record-breaking trading Larry Williams used the Kelly’s formula where the starting risk was defined by the size of the margin per futures fontract. The dynamics of the capital were also noteworthy: first a growth from $10 000 to означает наименьшее из списка. Clearly, we must not take the %risk_guaranted_profit larger than the optimal for the guaranteed profit. A variant of this method where a constant risk is maintained on the basis of guaranteed profits is described by Titov.

% risk for the profit

Net Profit

Avg. profit/ Avg.loss

Avg. trade

Maximal drawdown

Profit factor

0

128611.02

2.4429

680.4816

-62698.391

1.6072

1

519913.94

2.0757

624.1464

-178268.09

1.5116

2

3595571.00

1.6486

4528.427

-6062935.5

1.2283

 Regulating the position size on the basis of its risk and volatility. The risk of an open position is usually controlled by exit rules set in the system. For instance, moving stop levels follow the price to increase starting risk or lock down a part of paper profits. But a much more viable idea is to limit the maximal risk and volatility of an open position in relation to the capital. All we need for this is track the values as often as needed.

Excessive_risk = Num_lots * Current_risk_per_unit_of_assets – Max%risk * Capital / 100

and

Excessive_volatility = Num_lots * Current_volatility_of_assets –

Max%volatility * Capital / 100.

As soon as any of those becomes positive, we decrease the position size by a value equal to:

Excessive_num_lots = Excessive_risk / Lot_price

Or correspondingly by:

Excessive_number_lots = Excessive volatility / Lot_price

 The practical rationale of this methods is closing a part of the position without waiting for the system signal, when the prices move very fast and far, too far and fast for a trailing stop or a closing point to follow. This solves two tasks at once: first, the risk and volatility are supported at set levels, second, positions frequently close at extreme prices with favourable slippage.

Such methods for one strategy on one asset can be easily applied on the TradeStation platform as shown in App.1. But since real trading involves several strategies applied to portfolios of assets, frequently at different time frames but with a commom portfolio capital. The organization of money management at portfolio level will be discussed in the next article.

Appendix 1

{****************************************************

The Simplest System #3 with Money Management.

Copyright (c) 2002 DT

****************************************************}

Input: Price((H+L)*.5),

PtUp(4.), PtDn(4.), {Max correction to change trend}

MM_Model(2), {1 = % Risk Model; 2 = % Volatility Model;

3 = Drawdown Model; 4 = Kelly Model; 5 = Williams' Model;

6 = Fixed Ratio Model; 7= Market Money Model}

MM(1), {% Risk parameter}

MM_add(0), {% Risk for playing market money; 0 to disactivate}

MaxVolat(100), {% Risk for playing market money; 100 to disactivate}

MaxDD(20), {% Drawdown}

InitCapital(100000); {Initial capital to trade}

Vars: LL(99999), HH(0), Trend(0), Volat(TrueRange);

Vars: MP(0), Risk(Range), Num(1), add_num(0), red_num(0), FRDelta(0), DD(0),

Equity(InitCapital), TotalEquity(InitCapital), EqTop(InitCapital),

AssuredProfit(0), HPositionProfit(0), Kelly(0);

MP = MarketPosition;

Volat = .5 * TrueRange + .5*Volat[1];

if MP <= 0 then begin

if Price < LL then LL = Price;

if Price cross above LL*(1 + PtUp*.01) then begin

Trend = 1;

HH = Price;

end;

end;

if MP >= 0 then begin

if Price > HH then HH = Price;

if Price cross below HH*(1 - PtDn*.01) then begin

Trend = -1;

LL = Price;

end;

end;

If trend = 1 then Risk = PtDn * .01 * close {+ Slippage};

If trend = -1 then Risk = PtUp * .01 * close {+ Slippage};

HPositionProfit = maxlist( OpenPositionProfit, HPositionProfit);

AssuredProfit = HPositionProfit - Risk;

Equity = InitCapital + NetProfit;

TotalEquity = Equity + OpenPositionProfit;

EqTop = MaxList(EqTop, TotalEquity);

if MM_Model = 1 then { % Risk Model }

Num = floor(MM * Equity *.01/Risk);

if MM_Model = 2 then { % Volatility Model }

Num = floor(MM * Equity *.01/ Volat / BigPointValue );

if MM_Model = 3 then begin { Drawdown Model }

Num = floor(MM * (Equity - (1 - MaxDD*.01) * EqTop) * .01 / Volat / BigPointValue);

end;

if MM_Model = 4 then begin { Kelly Model }

If TotalTrades > 20 and GrossProfit > 0 then

Kelly = NumWinTrades/TotalTrades * (1 - GrossLoss/GrossProfit)

else

Kelly = 0.1;

if Kelly > .9 then Kelly = .9;

Num = floor(MM * Kelly * Equity * .01 / Risk);

{Print(Kelly);}

end;

if MM_Model = 5 then begin { Larry Williams' Model }

value11 = MaxList(-LargestLosTrade / MaxList(CurrentContracts, 1) , Risk);

Num = floor(MM * Equity *.01 / value11);

end;

if MM_Model = 6 then begin { Fixed Ratio Model }

{ DD = MaxList(DD, (EqTop - TotalEquity)/MaxList(CurrentContracts, 1)) ; {Max Drawdown}

if TotalTrades > 20 and DD > 0 then FRDelta = MM * DD *.01

else }

FRDelta = MM * volat * BigPointValue * .01; {Delta}

value12 = MaxList(Equity - .5*close*(close + FRDelta)/FRDelta, 0.25);

Num = floor(SquareRoot(2*value12/FRDelta + .25) + .5);

end;

if MM_Model = 7 then { Playing the market money }

num = floor((MM * (InitCapital + MinList(NetProfit, 0)) + MM_add * MaxList(NetProfit, 0)) * .01 / Volat / BigPointValue);

{ Entries}

if trend = 1 and trend[1] <> 1 then buy("Trend.LE") num contracts at market;

if trend = -1 and trend[1] <> -1 then sell("Trend.SE") num contracts at market;

add_num = floor( MM_add * AssuredProfit * .01/ Volat / BigPointValue); { Assured Profit Pyramiding }

if add_num > 0 and OpenPositionProfit > Volat * BigPointValue then begin

if Trend = 1 and MP = 1 then buy("Add.LE") add_num contracts at market;

if Trend = -1 and MP = -1 then sell("Add.SE") add_num contracts at market;

end;

red_num = floor((CurrentContracts * Volat * BigPointValue - MaxVolat * TotalEquity * .01)/ close);

if red_num > 0 then begin

if Trend = 1 and MP = 1 then exitlong("Red.LX") red_num contracts at market;

if Trend = -1 and MP = -1 then exitshort("Red.SX") red_num contracts at market;

end;

if Num < 1 then Num = 1;

Appendix 2.

Add the following lines to the code of the system handling the lot:

{****************************************************

Excel output for optimal f computation

Copyright © 2002 DT

****************************************************}

Var: Trades(0), Str("");

Trades = totaltrades;

if currentbar = 1 then begin

FileDelete("D:\TS_Export\M-Trading3_OptF.csv");

Str = "Initial Equity" + "," + "Max Loss" + "," + "f" + "," + "Trades" + "," + "Geom Mean" + NewLine + NewLine

+ "Profit" + "," + "HPR" + "," + "TWR" + "," + "Equity" + "," + "Num" + NewLine;

FileAppend("D:\TS_Export\M-Trading3_OptF.csv", Str);

end;

if trades <> trades[1] then

FileAppend("D:\TS_Export\M-Trading3_OptF.csv", NumToStr(PositionProfit(1),3) + newline);

{****************************************************}

and launch the system. When we open in Excel the resulting file, we’ll see a table:

Calculating the optimal f in Excel.

A

B

C

D

E

1

Initial Equity

Max Loss

f

Trades

Geom Mean

2

100000

-49.9

0.1

184

1.004012

3

Profit

HPR

TWR

Equity

Num

4

-12

0.966014

0.966014

96601.43

273

5

11

1.031154

0.996109

99610.91

282

Enter the starting capital in the A3 field, the formula =MIN (A4:A

Х) in the B3, where AX designates the last non-enpty field in the A column.

Enter =1- C$2*A4/B$2 in B4 and continue till line X.

Enter any value from 0 to 1 in the C2 field, С4 = В4, С5 = С4*В5, D4 =A$2*C4, D2 = COUNTIF(A4:AX,"<>0"), E2 = POWER (CX,1/D$2), E4 = INTEGER (D4/(B$2/-C$2)). Continue the formulas in the С4:Е4 fields till the last non-empty line Х. In the E column we have the number of lots for the f value given in the С2 field.

To calculate the optimal f use the menu: Service à Solution Search à designate target field: $C$Y (where Y – number of the line corresponding to the trade previous to the one we optimize f for); Changing fields: $C$2; Limits: $C$2 >=0; $C$2 <= 1 à Execute.

Excel’s in-built optimizer will find the value of the optimal f, maximizing the TWR function.  

 Appendix 3.

The method states the number of lots traded to capital growth needed to increase the number of lots should be a constant value. This will be written down as:

En + n * D = En+1

 where En – current capital, n – current number of lots, D – the Delta parameter. Then, recursively,

En = En-1+ (n – 1) * D = En-2 + (n – 2) * D + (n – 1) * D = …

= E1 + (1 + 2 + … + (n – 1)) * D,

hence, considering the fact the bracketed expression is a sum of an arithmetical progression members

En = E1 + 0.5 * n * (n – 1) * D.

This equation is a square equation in relation to n:

n^2 – n – 2 * (En – E1 ) / D = 0.

High school analysis course tells us this equation has two roots:

n1 = 0.5 + (2 * (En – E1 ) / D + 0.25)^(0.5)

and

n2 = 0.5 – (2 * (En – E1 ) / D + 0.25)^(0.5),

where n2 <= 0. If we consider En – E1 to be the profit, then:

Num_lots = 0.5 + (2 * Profit / Delta + 0.25)^(0.5).

This formula starts trading with one lot. If the starting capital allows to trade many lots at once, we must find the En – E1 considering the starting capital. Clearly, En = Starting Capital + profit. One Delta can buy k = Price / Delta stocks. The corresponding Ek capital is equal to

k * Price = Price^2 / Delta. Then

E1 = Ek

 Deriving the formula for the fixed fraction method.– 0.5 * k * (k – 1) * D = 0.5 * Цена * (Цена + D) / D,

And our desired formula will be

Number_lots = 0.5 + (2 * (Starting_capital + profit - 0.5 * Price * (Price + Delta) / Delta) / Delta + 0.25)^(0.5).

. Controlling the drawdowns.

 

 

台長: 期指贏家
人氣(1,513) | 回應(0)| 推薦 (0)| 收藏 (0)| 轉寄
全站分類: 財經企管(投資、理財、保險、經濟、企管、人資) | 個人分類: 期股導論 |
此分類下一篇:投資過程中的頭寸管理
此分類上一篇:止損線可能就是你的生命線

是 (若未登入"個人新聞台帳號"則看不到回覆唷!)
* 請輸入識別碼:
請輸入圖片中算式的結果(可能為0) 
(有*為必填)
TOP
詳全文