What is your strategy?

Discussion in 'Risk Management' started by kut2k2, Mar 28, 2014.

Thread Status:
Not open for further replies.
  1. Yeah, that's it, thanks Visaria.
     
    #41     Mar 29, 2014
  2. Visaria

    Visaria

    The point of Kelly is to find the optimal fraction of bankroll to use, variance doesn't come into it unless you can't take the heat. In this situation, we know precisely the probabilities of each outcome and only have a thousand dollars at risk. So no need to scale down Kelly.
     
    #42     Mar 29, 2014
  3. Right, that's what I thought, too, but after running the Monte-Carlo simulation on this problem, the results are totally not what I expected. The top strategy is this combo: {R16:60%, R14:30%, Red:10%}. So, it's a bet of 100% of the bankroll on every bet that maximizes the average profit over many trials. The question is, why so reckless? Well, if you think about it, this strategy has an absolutely enormous variance. Essentially, the result is either an almost certain total loss of $1,000, or a very small chance of a huge gain (in the order of $10 million after the 10 spins of the wheel). When these outcomes are averaged, the average is still in the millions with this full allocation.

    I am trying to think about this problem as applicable to position sizing in trading, and clearly, no one in their right mind would risk 100% of the capital on every trade. So, I do think that the adjustment for volatility is needed.

    As an experiment, I added a heavy penalty to the strategies which result in the drawdown of more than 50% during the run, and with that penalty in place, the top strategy was a much more believable {R16:7%, R14:0%, Red:0%}

    I'll post my code and the results later.
     
    #43     Mar 29, 2014
  4. Ok, here is the Java code for the Monte-Carlo simulation. It creates 176851 strategies with the different allocation of capital to R16, R14, and Red, and then spins the wheel 10 times. This counts as one trial. At the end of the trial, the profit is calculated for each of the 176851 strategies. Then this trial is repeated 1000 times, and the average profit for each strategy is calculated. At the end, it prints 3 sets of results, based on the maximum allowed drawdown.

    Code:
    package com.et.portfolio;
    
    import java.util.*;
    
    public class Portfolio {
        private final static double startEquity = 1000;
        private static int maxAllowedDrawdown; // as percent
        private final static long numberOfSpins = 10L;
        private final static long numberOfTrials = 1000L;
        private final static double oneHundred = 100d;
    
        public static void main(String[] args) {
            Portfolio portfolio = new Portfolio();
    
            maxAllowedDrawdown = 25;
            portfolio.test();
            maxAllowedDrawdown = 50;
            portfolio.test();
            maxAllowedDrawdown = 75;
            portfolio.test();
        }
    
        class Strategy implements Comparable<Strategy> {
            private final int betR16, betR14, betRed;
            private double equity, averageProfit, equityPeak;
            private long trials;
    
            Strategy(int betR16, int betR14, int betRed) {
                this.betR16 = betR16;
                this.betR14 = betR14;
                this.betRed = betRed;
                equity = equityPeak = startEquity;
            }
    
            private void update(int outcome) {
                if (outcome >= 1 && outcome <= 4) {  // R-16
                    equity += 35 * equity * (betR16 / oneHundred);
                }
    
                if (outcome >= 5 && outcome <= 7) {  // R-14
                    equity += 35 * equity * (betR14 / oneHundred);
                }
    
                if (outcome >= 1 && outcome <= 23) { // red
                    equity += 1 * equity * (betRed / oneHundred);
                }
    
                if (outcome >= 24 && outcome <= 37) {  // anything other than red-16, red-14, or red
                    equity -= equity * (betR16 + betR14 + betRed) / oneHundred;
                }
    
                if (equity > equityPeak) {
                    equityPeak = equity;
                }
    
                double drawdown = 100 * (1 - (equity / equityPeak));
                if (drawdown >= maxAllowedDrawdown) {
                    averageProfit = Double.NEGATIVE_INFINITY; // heavy penalty
                }
            }
    
            private void update() {
                averageProfit += (equity - startEquity);
                equity = equityPeak = startEquity;
                trials++;
            }
    
            public long getAverageProfit() {
                return (long) (averageProfit / trials);
            }
    
            public double getEquity() {
                return equity;
            }
    
            @Override
            public int compareTo(Strategy other) {
                return Long.valueOf(other.getAverageProfit()).compareTo(getAverageProfit());
            }
    
            @Override
            public String toString() {
                String line = "\t" + betR16 + "\t" + betR14 + "\t" + betRed + "\t" + getAverageProfit();
                return line;
            }
        }
    
        private void test() {
            int min = 1;
            int max = 37;
    
            List<Strategy> strategies = new ArrayList<>();
    
            int maxPercent = 100;
            for (int betR16 = 0; betR16 <= maxPercent; betR16++) {
                for (int betR14 = 0; betR14 <= maxPercent; betR14++) {
                    for (int betRed = 0; betRed <= maxPercent; betRed++) {
                        if (betR16 + betR14 + betRed <= maxPercent) {
                            Strategy s = new Strategy(betR16, betR14, betRed);
                            strategies.add(s);
                        }
                    }
                }
            }
    
            System.out.println("total strategies: " + strategies.size());
    
    
            Random random = new Random();
            for (int trial = 1; trial <= numberOfTrials; trial++) {
                for (int spin = 1; spin <= numberOfSpins; spin++) {
                    int outcome = random.nextInt(max + 1 - min) + min;
                    if (outcome < 1 || outcome > 37) {
                        throw new RuntimeException("unexpected outcome: " + outcome);
                    }
    
                    for (Strategy s : strategies) {
                        s.update(outcome);
                    }
                }
                for (Strategy s : strategies) {
                    s.update();
                }
            }
    
            Collections.sort(strategies); // sort from the best to worst
            int count = 0;
    
            String line = "Max allowed drawdown: " + maxAllowedDrawdown;
            System.out.println(line);
            line = "\t" + "R16" + "\t" + "R14" + "\t" + "Red" + "\t" + "AveProfit";
            System.out.println(line);
            for (Strategy s : strategies) {
                System.out.println(s);
                count++;
                if (count >= 10) { // only show the top 10 strategies
                    break;
                }
            }
        }
    }
    
    
     
    #44     Mar 29, 2014
  5. And here are the results, which are the top 10 strategies, for each of the max allowed drawdown:

    Code:
    	Max allowed drawdown: 25
    	R16	R14	Red	AveProfit
    	3	0	0	1609
    	2	1	0	1449
    	1	2	0	1224
    	2	0	2	1053
    	2	0	1	995
    	0	3	0	953
    	2	0	0	938
    	1	1	2	885
    	1	1	1	833
    	1	1	0	781
    
    	Max allowed drawdown: 50
    	R16	R14	Red	AveProfit
    	7	0	0	6788
    	6	1	0	6485
    	5	2	0	6117
    	4	3	0	5746
    	3	4	0	5427
    	0	7	0	5405
    	6	0	1	5287
    	2	5	0	5218
    	1	6	0	5185
    	6	0	0	5044
    
    	Max allowed drawdown: 75
    	R16	R14	Red	AveProfit
    	12	2	0	44417
    	13	1	0	44277
    	11	3	0	43200
    	14	0	0	42618
    	10	4	0	40948
    	9	5	0	38051
    	12	1	1	37303
    	11	2	1	36965
    	13	0	1	36365
    	12	1	0	35588
    
    
    Note that the theoretically calculated combo {R16:8, R14:0, Red:0), which both Visaria and I calculated, comes very close to the top strategy from the Monte-Carlo simulation, at 50% max drawdown: {R16:7, R14:0, Red:0).
     
    #45     Mar 29, 2014
  6. kut2k2

    kut2k2

    Thanks for demonstrating why I have no use for MCS. There is no optimal strategy that ever risks total loss like the one above does. The first time the ball lands on a black number or the green number, you're done. That's nowhere near optimality.
     
    #46     Mar 29, 2014
  7. I believe that the above Monte-Carlo simulation results are totally valid. In the extreme case of a 100% allocation, they simply show that if you are willing to blow your account thousands of times, eventually you would make enough to recoup all the losses. In other words, it assumes that you can play this game an infinite number of times, and that you have a never ending source of the new capital. Of course, no trader can and should operate this way, and this is where I believe the risk-adjustment should be made, either in the form of the max acceptable drawdown, or even better, the volatility of the final bankroll. I will make that adjustment tomorrow, and re-run the simulation.
     
    #47     Mar 30, 2014
  8. dom993

    dom993

    When was the last time the law of large number was applicable to small sample-sets, 10 or even 1 as you suggest?

    I welcome the proof here that the Kelly fraction is the way to bet on a 1-spin limit. I will certainly learn something and have no shame about it.
     
    #48     Mar 30, 2014
  9. dom993

    dom993

    Here are some MC results:

    8%-bankroll Red-16 : ending bankroll 50th percentile +1823, stdev 68626
    4%-bankroll Red-16 : ending bankroll 50th percentile +1682, stdev 7463
    $50 fixed bet Red-16: ending bankroll 50th percentile +2350, stdev 1821

    Those 3 strategies guarantee a minimum ending bankroll of +438, +669, +500 respectively.

    6.7%-bankroll Red-16 is the one fractional strategy that guarantees a minimum ending bankroll of +503, ie. similar to fixed bet $50. Its results are:
    ending bankroll 50th percentile +1821, stdev 22539


    Now do you still think Kelly applies to small sample-sets?
     
    #49     Mar 30, 2014
  10. kut2k2

    kut2k2

    The Kelly fraction is the optimal geometric growth fraction. It by definition is the betting strategy that will grow your bankroll the fastest for a given trading strategy. If you had only a single spin, which better betting strategy would you use instead of Kelly?

    Remember: we have yet to determine what the best trading strategy is for this roulette example, which boils down to which bets to take. It appears that incorporating Kelly is a necessary component to deciding what will be the best trading strategy.
     
    #50     Mar 30, 2014
Thread Status:
Not open for further replies.