Home     News     Software     Order     Download     Support     Publications     Research     Contacts  
   Home

   News

  •  

  • Latest News
      
  •  

  • World News
      
  •  

  • Our achievements
      
       Software

  •  

  • TradeStation Solutions
      
  •  

  • Portfolio Software
      
  •  

  • Genetic Optimization
      
  •  

  • eSignal Solutions
      
  •  

  • Matlab & TradeStation Solutions
      
  •  

  • Excel & TradeStation Solutions
      
       Order

       Download

  •  

  • Free Download
      
  •  

  • Update
      
       Support

  •  

  • Online Help
      
  •  

  • Upgrade Policy
      
       Publications

  •  

  • Fractal dimension – numerical characteristic of trend
      
  •  

  • Volatility Models
      
  •  

  • Genetic optimization. Application in TradeStation environment.
      
  •  

  • Trading Systems Free
      
  •  

  • Money Management
      
  •  

  • The Foundations of Money Management I
      
  •  

  • The Basics of Money Management II
      
  •  

  • The Basics of Money Management III
      
       Research

  •  

  • TS Excel Link's using example
      
  •  

  • Strategy Optimization, Curve Fitting and Walk Forward Analysis.
      
  •  

  • Entropy Indicator in TradeStation using Matlab
      
  •  

  • TradeStaion Genetic Optimizer
      
       Contacts

    Money Management: The Basics of Money Management III

    Controlling the drawdowns.

    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

    0.9994

    Optimal f. 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.

    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. Leo Zamansky and David Stendahl tried to overcome large drawdowns by adding a special limit of maximall allowable drawdown:

    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.

    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

    The Table 3. The Results of the testing the method fixed relations.

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

    $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. 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:

    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.означает наименьшее из списка. 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.

    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.

    % 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. Calculating the optimal f in Excel.

    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_ExportM- Trading3_OptF.csv");

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

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

    FileAppend("D:TS_ExportM- Trading3_OptF.csv", Str);

    end;

    if trades <> trades[1] then

    FileAppend("D:TS_ExportM-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:

    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. Deriving the formula for the fixed fraction method.

    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 – 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).



    <<< The Basics of Money Management II



    Developed by: webdesign.tria.lv  

      About | Privacy Statement | Terms of use | TradeStation Disclaimer

    Copyright © 2004 TS Smart Research

    time: 0.0528 | queries: 2