Unicorn Trading
ProSizerTM Documentation

| Home | ProSizer | FAQ | Documentation | Competition | Purchase ProSizer |

Copyright © 2004-2008 by Alex Matulich and Unicorn Research Corporation. All rights reserved.

This application is provided "as is." No guarantee exists concerning its operation, usefulness, adequacy for your needs, or effect on your trading performance. Neither the author nor Unicorn Research Corporation are responsible for any consequences, good or bad, that result from using this application. You trade at your own risk. Your trading decisions are your responsibility alone.

This spreadsheet lets you analyze position sizing strategies, including "optimal-F" optimization applied to hundreds of random trade orderings using Monte Carlo simulation. Also see the FAQ for answers to frequently asked questions.


Generally speaking, one can size one's trades according to the following five position sizing models (where all lot sizes are rounded to the nearest integer number):

  1. Fixed Lot
    Trade a constant lot size on every trade (100 shares, or 1 contract). This model never skips trades, and stops trading if equity shrinks smaller than the margin required to trade one lot.
  2. Fixed Fraction
    Adjust the lot size so that each trade allocates a fixed percentage of your equity.
    LotSize = K * Equity
    where K = EquityFraction / InitialMargin

    This model never skips trades, but stops trading if the fixed fraction of equity (Equity*EquityFraction) decreases below the InitialMargin amount.
    There are several variants of this model. All these variants simply determine the value of K different ways. For example:
    Once you determine the value of K for one of these Fixed Fraction variants, you can determine the parameter values for any of the other variants.
    There are other variants that use a non-constant value of K (i.e. K is different for each trade). Two of these are model #4 (Percent Risk) and model #5 (Percent Volatility) described below. Percent Risk uses a variable risk (initial stop) per trade. Percent Volatility uses the market's changing volatility to determine position sizes. These two models typically give better results than the constant-K variants above.
    Hysteresis: ProSizer's fixed fraction model has two inputs, the fixed fraction of equity and "hysteresis maximum". Set hysteresis maximum to 0 (or anything less than the fixed fraction input) to disable this feature. What this does is make the fixed fraction trading more agressive, trading the higher fraction when equity is declining, and the normal fraction at other times. This feature is ignored on the combo worksheet.
  3. Fixed Ratio
    This position sizing model was popularized by Ryan Jones in his book The Trading Game. It amounts to adjusting the lot size as a function of net profit. The implementation here works like this:
    LotSize = SquareRoot[2*NetProfit/delta + 1/4 + (InitialLotSize^2 - 1)]
    if LotSize < 1 then LotSize = 1

    We use the input value 10,000/delta so that the input has a similar magnitude to the other inputs. The input value is then divided by 10,000 internally before calculating the number of lots to trade. The "lot size" input will be used for InitialLotSize. This model never skips any trades. It stops trading only when the equity shrinks smaller than the margin required to trade one lot.
    Because the fixed ratio model does not consider equity, and return and drawdown do depend on equity, careful attention must be paid to the setting of InitialLotSize, depending on starting equity, to arrive at optimum values of return and drawdown.
  4. Percent Risked
    Adjust the lot size so that the total amount risked (stoploss) for each trade is a fixed fraction of your equity.
    LotSize = RiskFraction * Equity / TradeRisk
    This model can skip trades, or stop trading, if the risk fraction of equity shrinks smaller than the risk or initial stoploss one must endure to enter a trade. If your "risk" input column contains a constant value for risk (as you would input if you didn't have risk data on a per-trade basis), then this model becomes the fixed fraction model. Its power derives from having the risk, or initial stoploss size, of each individual trade. Given that information, it routinely outperforms the other sizing models described above.
  5. Percent Volatility
    Adjust the lot size so that the market volatility (in dollars per lot, often measured as the average True Range of the last 10-20 bars) is no more than a fixed fraction of your equity.
    LotSize = VolatilityFraction * Equity / Volatility
    This model can skip trades, or stop trading, if the volatility fraction of equity shrinks smaller than the market's volatility. This model also converts to a fixed fraction model if you have a constant value in the "volatility" input column.

The first two techniques are fairly crude and are most commonly employed by traders. The third technique (fixed ratio) will usually offer the best performance without taking into account individual trade risk or market volatility (which makes this model rather aggressive for small accounts). The last two techniques, described in the book Trade Your Way to Financial Freedom by Van K. Tharp, are more sophisticated and can result in significantly greater profit, for a given amount of drawdown, than the first three techniques. The %risk and %equity models, although simple, provide elements of capital preservation, risk control, and conservatism that the other models lack.

All position sizing models in this application round to the nearest integer number of lots (add 1/2 to each formula above and take the integer part). Some would advocate rounding down only. In practice it makes little difference except for very small accounts.


Optimal-F, described by Ralph Vince in his book Portfolio Management Formulas, is the ideal fraction of equity that must be risked on each trade to maximize equity growth. Trade too small, and you make money too slowly; trade too large and you're liable to go bankrupt. Somewhere in between there is an optimum fraction of equity to risk.

Problems: One problem with Optimal-F is that the position sizes found for maximum equity growth always involve huge risks that few traders can stomach. Another problem is that Optimal-F finds an answer based only on the sequence of trades given. Although the optimal fraction (using the fixed fraction model) would still be the same if the trades occurred in a different order, the return and drawdown would be different. Applying Optimal-F to only one sequence won't give you a complete picture of what your trading system can throw at you in terms of return and drawdown.

Solution: This is where a Monte Carlo simulation comes in useful. Using Monte Carlo, we can rearrange the trades into random sequences hundreds of times, gather statistics on the results, and get a good idea of the variability in equity growth and drawdown that we can expect. We can then use these statistics to determine a more reliable Optimal-F for the trading system, having an acceptable return and tolerable risk.

In addition, this spreadsheet will let you determine optimal fractions based on different position sizing models as well as for combinations. The position models described above, in paired combinations using the minimum, maximum, or average lots generated by each model, give 30 different models available to you, such as "Spear's algorithm" which uses the maximum lots from the percent risk and percent volatility models.


The Data worksheet

Use this worksheet to input your data (3 columns: profit, risk [initial stoploss], and market volatility [e.g. 20-bar Average True Range]). Use the same units for these columns as well as for the other inputs; either currency units or market points, but not both. Set the yellow cells to appropriate values and see the results of the Monte Carlo simulation, as well as for the specific sequence of trades you supplied.

You can select one of the five position sizing models, or a combination of any two models, as well as a rule to use the minimum, maximum, or average quantity determined by each model. Thirty different combinations are possible (excluding those where both models are the same). The number of Monte Carlo iterations should be at least 100. Each time you press F9 to recalculate, the Monte Carlo statistics will change slightly. More iterations will reduce these variations, but there's a point of diminishing benefit after a few thousand iterations.

The results of the Monte Carlo simulations are displayed in a table of statistics showing statistics for return, maximum drawdown, and return/drawdown ratio, along with chance of ruin, and the averages of the maximum number of winning and losing trades in a row. Below the table appear plots showing histograms of return, log max drawdown, and return/drawdown ratio, along with the corresponding cumulative probability distributions. The horizontal scale of each plot goes from the minimum to the maximum value. The vertical blue line in each plot shows the position of the mean, the vertical magenta line shows the median, and the vertical green lines are positioned at 1 and 2 standard deviations from the mean.

Two checkboxes appear below the results table:

  1. Non-unique trades (replacement): If this box is checked, then any executed trade may be executed again by a random drawing; i.e. the trades will not all be unique. While this gives a more robust Monte Carlo result for small numbers of trades, it also slows down processing by a factor of 5, because the trades drawn from the original sequence are used to fill a sequence 5 times the original length. If this box is not checked, then the uniqueness of trades is preserved; i.e. all trades are considered, but in scrambled order.
  2. Don't scramble: This checkbox shows you the effect that the position sizing strategy has on the original sequence of trades. This checkbox has no effect on the Monte Carlo results, however.

This worksheet does no optimizations; it just shows you the result of a position sizing strategy using the inputs you give. At any time you may view an equity curve for the currently displayed sequence of trades by clicking on the EquityChart tab. The Combo worksheet lets you optimize a position sizing strategy.


  1. Maximum Drawdown has a lognormal distribution. Therefore, a simple arithmetic mean and standard deviation of the maximum drawdowns from the Monte Carlo trials will not give valid results. One must calculate the mean and standard deviation of the logs of maximum drawdowns instead, and then convert back to non-log scale. The values displayed are calculated as follows:
    MeanLogDD = average( ln drawdown_1 ... ln drawdown_n )
    StDevLogDD = stdev( ln drawdown_1 ... ln drawdown_n )
    MeanDD = exp(MeanLogDD)
    MeanDD + N*StDevDD = exp(MeanLogDD + N*StDevLogDD)

    "ln" is "natural logarithm" or (log base e) and "exp(x)" is "e to the power of x."
    This is explains the uneven spacing of the standard deviation lines in the Maximum Drawdown plot. The displayed standard deviation for max drawdown is actually just the size of the first standard deviation above the mean.
  2. The Chance of Ruin (or %ruined) result is not the "Probability of Ruin" calculation described in other sources. Here, Chance of Ruin is simply the percentage of Monte Carlo iterations having a maximum drawdown greater than whatever drawdown you defined as "ruin." For example, if you can't tolerate more than 60% drawdown, then use 60% as your "ruin." The result shows the percentage of trials exceeding your ruin threshold.
  3. The Monte Carlo results labeled mxCnsWin and mxCnsLos are the average of the maximum consecutive winners and maximum consecutive losers in all Monte Carlo iterations. These are not the average consecutive wins and losses. These are the average of the maximums found during the Monte Carlo testing. There's no point displaying the maximum of the maximums. We already know that the theoretical maximum consecutive wins is simply the number of wins in the input sequence.
  4. The "Ignore equity" button is an experiment. If you check it, it causes all models to ignore equity in the same way as the Fixed Ratio Model does. That is, net profit will be used to determine the change in position size, and this will be added to the initial lot size. If this box is un-checked, only the Fixed Ratio model ignores equity. Checking this box removes the ability of %risk and %equity models to manage risk and preserve capital! This is experimental.

The EquityChart worksheet

This sheet shows you a chart of the equity on the Data worksheet. If the "Don't scramble" checkbox on the Data worksheet is un-checked, you may press F9 to generate different possible equity curves for different trade sequence orderings. If this box is checked, the EquityChart shows you the equity curve for the original sequence.

The "pseudo-Sharpe ratio" result displayed isn't really the Sharpe ratio although it's calculated similarly, but without regard to time interval. This isn't a useful result other than a measurement of the consistency of returns.

The Combo worksheet

This worksheet shows four tables, but you need only use the first one. The other three tables just present the results in different ways. The tables contain much information! The first table shows all of this simultaneously:

Your objective is to find the cell having the highest return, the highest return/drawdown ratio, and a drawdown below your cutoff threshold with a return/drawdown ratio greater than the inverse of your cutoff threshold.

The "optimum" parameters for the combination are given by the cell in the table that meets all of these criteria:

  1. Largest number among all the light-colored cells (indicating the highest return)
  2. Lightest color (indicating the highest return/drawdown ratio)
  3. The displayed number in the cell must be black, not gray (indicating that the average drawdown is less than the cutoff threshold you set)
  4. The displayed number in the cell must be boldface, not normal (indicating that the return/drawdown ratio is greater than the inverse of your drawdown cutoff; e.g. if you set a drawdown cutoff of 25%, the return/drawdown ratio must be greater than 4, or 1/0.25).
  5. The displayed number in the cell must not be pink italic (no chance of ruin).

Table 2 shows the same information as Table 1, but reversed (numbers are return/drawdown ratios, colors are average returns). Table 3 shows the average drawdown as a percentage of equity. Table 4 shows the Chance of Ruin for each combination, with italic pink text indicating any Chance of Ruin over 50%. Table 1 and 2 also display returns as italic pink if the Chance of Ruin exceeds 50%.

On this worksheet you will find input cells for defining the limits of each axis in the tables, and for adjusting the color scale.

If the colors appear scattered (not contiguous) try increasing the Monte Carlo iterations to smooth them out. You can use as little as 10 iterations for quick looks while zooming in on the optimum ranges for each axis.

The Documentation worksheet

You're looking at it.

| Home | ProSizer | FAQ | Documentation | Competition | Purchase ProSizer |

Copyright © 2004 by Unicorn Research Corporation
All rights reserved.