Investing Strategy - Experiment

in #invest7 years ago (edited)

Investing Strategy - Experiment

Yesterday I got the idea about a simple investing strategy:

Keep a relatively fixed value of money in the bond.
Let the rate be growing and falling completely randomly +/- x%.

That makes for +20%, then back to start value:

  • Invest 100
  • Wait (+20%)
  • Gain 120, Invest of that 100 (fixed value of money)
  • Wait (-16.667%)
  • Gain 83.33

Result: +3.33

And for -20%, then back to start value:

  • Invest 100
  • Wait (-20%)
  • Gain 80, Invest of that 100 (you've to add 20 from your pocket; in real life you would set a piece of your money, not all, so there is a rest)
  • Wait (+25%)
  • Gain 125

Result: +5.00

So it actually looks like a nice strategy.

I wrote a test bench for it, and with a randomly falling and rising rate, it did work (avg), even if the course was averagely falling, it still did work.

For 100 cycles of 20 times *(1+ upto 10%) or /(1+ upto 10%) and 10% of start money invested (if the money was to few, it used this value), it generated +31% (avg, var (26%)², 100,000 times run)!

It really seems/ed to work!

Now to the sad part: as you might imagine, and because there are a lot of different strategies plus predictions, which never would work on a completely random rate, it IS NOT COMPLETELY RANDOM in reality!

I tested the algorithm on the exchange rates of Adidas and VW from 2015 to 2017, tested from a little differing starting points, and had bad negative values! The rate of the Deutsche Bank had a slight grow.

Summary:

the experiment included no transaction fees, and would probably work even with those on purely random courses, however, they are not. I might try other strategies and test them, too :). Well, if one will work, I won't tell about it ;D. It was great to see the difference in being random there :).

Code (JS, named in German):

function Gesellschaft(){
    this.kurs = 1;
}

Gesellschaft.prototype = {
    tick(){
        var r = Math.random()*2-1;
        this.kurs = r > 0 ? this.kurs * (1+abs(r)*.1) : this.kurs / (1+abs(r)*.1);
    },
    kaufe(geld){
        return new Aktie(geld / this.kurs, this);}
}

function Aktie(value, gesellschaft){
    this.value = value;
    this.gesellschaft = gesellschaft;
}

Aktie.prototype = {
    verkaufe(){return this.value * this.gesellschaft.kurs;}
}

function test(){
    
    var ss = 0, sx = 0;
    var kx = 400, fk = 1/kx;
    for(var k=0;k<kx;k++){
        
        var kurs = new Gesellschaft();
        
        kurs.tick();
        for(var i=0;i<k;i++) kurs.tick();
        
        var m = 1000, sm = m;
        for(var i=0;i<100;i++){
            
            var s = min(m, 100);
            var a = kaufe(s, kurs);
            m -= s;
            
            for(var j=0;j<1;j++){
                kurs.tick();
            }
            
            m += a.verkaufe();
        }
        
        m /= sm;
        m -= 1;
        
        ss += m;
        sx += m*m;
    }

    ss *= fk;
    sx *= fk;

    var stabw = Math.sqrt(sx - sq(ss));
    
    console.log(ss+(stabw?" +/- "+stabw:""));
    
}