Fully automated futures trading

Discussion in 'Journals' started by globalarbtrader, Feb 11, 2015.

  1. Actual account figures

    Rob / GAT
     
    #3291     Mar 10, 2022
  2. I know it hurts, but a very sharp reversal is often the best thing that can happen to a trading system like this. The vol scaling will cut your positions quickly, reducing further losses. The alternative, a slow reversal, means you have to wait for forecasts to reduce your position and by then you will have lost almost all your gains.

    Of course that assumes we are the end of the trend... if not then at least you are in a position to benefit from . Important thing is risk is reduced, and rightly, since we are less certain about what is happening next.

    Rob
     
    #3292     Mar 10, 2022
    djames likes this.
  3. This is actually (sort of) explained in the second post of the thread: https://www.elitetrader.com/et/threads/fully-automated-futures-trading.289589/#post-4085237

    What happened was when I started trading I had a 50% risk target, and then I dropped to 25% in December 2014 because it was way too scary.

    So for proper comparision when my code calculates the notional capital it automatically resizes historic figures so that my % returns are consistent; effectively it doubles my capital base pre December 2014 so it's initially 600K rather than the 300K notional I actually had.

    (Incidentally my actual account starting value was about 550K, but that isn't relevant; although it's how fundseeder and IB calculate my performance FWIW so again there are some differences in those early years)

    To work out my percentage returns I divide the actual £££ p&l by the notional capital on any given day. So I end up 50% for that earlier period rather than 100%, because the capital is doubled. I did actually make 100% on the notional capital I was employing, and when looking at cash profits that is reflected, but I'd rather factor out the change in risk target.

    (A lesson here is don't change your risk target, it makes life very hard!)

    The pair of graphs I posted in the very first post shows this effect happening, which is why I felt the need to explain it in the second post. So this was a retrospective change, but once I've applied since before this thread started.

    Just to make things even more complicated, prior to early December 2014, I was also compounding up my profits. So my max capital was actually as high as £420K, or notionally doubled £840K,

    From January 2015 it's simple because I'm using 25% risk on a notional capital of £400k, which is what I use today, so no further adjustments are required. In the very first post I say my risk is "25% annualised on the notional capital of £400,000)." So I'd already settled on this methodology by the time the thread started.

    I've said several times before that the £££ profit I have is basically higher than it would be if I had the same risk target. If you just add up all my % returns (adding up makes sense as I don't cumulate returns) you get about 144% to yesterdays close, or £576K on £400k. My actual accumlated profit to yesterdays close was £757K, about £180K less. That extra £180K was made by a combination of accumulating profits and having double the risk target in my first 9 months or so of trading.

    On the other hand, if I'd compounded my returns I would have made 333%, which even on my original notional £300k would have been a nice round million quid. On the other, other hand Fundseeder and IB that assume I cumulate and use my current account value as the capital divisor reckon I've made over 400%.

    Hope that helps.

    Rob
     
    #3293     Mar 10, 2022
  4. Millionaire

    Millionaire

    Thanks for the taking the time to explain.

    I copied your daily results into a nice monthly table, like hedge funds show monthly performance. So i can personally follow your results more easily. You might have posted something similar somewhere on your various blogs yourself, i didn't take a hard look. I have only seen you post that daily results spreadsheet. (I hope i didn't make any errors when creating the table from the daily % figures)

    Your trading is very inspirational and motivational, in that you are able to trade such a hard system so successfully through long drawdowns!


    Screenshot 2022-03-10 at 10.00.21.png
     
    Last edited: Mar 10, 2022
    #3294     Mar 10, 2022
    globalarbtrader likes this.
  5. That's awesome. Fundseeder have something similar, but without the colours. If I can trick something similar up in python, I'll see if I can get an auto updating table like that.

    Rob
     
    #3295     Mar 10, 2022
  6. djames

    djames

    I know you like to roll your own, but this is pretty nice https://github.com/quantopian/pyfol...4b7d83502e5c6f2e81aa/pyfolio/plotting.py#L143
    Code:
       
    sns.heatmap(
            monthly_ret_table.fillna(0) *
            100.0,
            annot=True,
            annot_kws={"size": 9},
            alpha=1.0,
            center=0.0,
            cbar=False,
            cmap=matplotlib.cm.RdYlGn,
            ax=ax, **kwargs)
        ax.set_ylabel('Year')
        ax.set_xlabel('Month')
        ax.set_title("Monthly returns (%)")
        return ax
    
     
    #3296     Mar 10, 2022
    globalarbtrader likes this.
  7. Small up today. As you'd expect after a big day, absolute s***load of trades, mostly closing.

    Code:
    ================================================================================================
                                             Broker orders                                        
    ================================================================================================
    
             instrument_code     strategy_name contract_date       fill_datetime  fill  filled_price
    order_id                                                                                      
    32033                BRE  dynamic_TF_carry    [20220500] 2022-03-10 15:02:43   [1]       0.19525
    32030         BRENT-LAST  dynamic_TF_carry    [20220600] 2022-03-10 14:00:35  [-1]     112.97000
    32028             EU-OIL  dynamic_TF_carry    [20220600] 2022-03-10 08:00:46   [1]     306.90000
    32027         FTSECHINAA  dynamic_TF_carry    [20220300] 2022-03-10 03:00:34  [-1]   13877.00000
    32019               IRON  dynamic_TF_carry    [20220500] 2022-03-10 01:25:37   [1]     159.85000
    32025           MSCISING  dynamic_TF_carry    [20220300] 2022-03-10 02:35:19  [-1]     309.65000
    32032                MXP  dynamic_TF_carry    [20220600] 2022-03-10 15:01:45  [-1]       0.04691
    32031            RUSSELL  dynamic_TF_carry    [20220300] 2022-03-10 15:00:37   [1]    1999.10000
    32034             SOYOIL  dynamic_TF_carry    [20220700] 2022-03-10 15:30:36  [-1]      70.90000
    32020              TOPIX  dynamic_TF_carry    [20220600] 2022-03-10 01:45:32   [1]    1801.25000
    32029                V2X  dynamic_TF_carry    [20220600] 2022-03-10 08:01:41   [1]      30.80000
    Interestingly I made £2k from not doing these trades at the close yesterday, due to the mini rebounds (most of that was in Brent). Bid/ask spread was £260, but I made £111 back on the execution

    Here's my current risk - v.low:

    Code:
    ********************************************************************************
               Risk report report produced on 2022-03-10 16:01:19.104883          
    ********************************************************************************
    
    
    Total risk across all strategies, annualised percentage 11.0
    
    ========================================
    Risk per strategy, annualised percentage
    ========================================
    
                      risk
    dynamic_TF_carry  11.1
    
    
    ===================================================================================================================================================================================================================================================================
                                                                                                                              Instrument risk                                                                                                                        
    ===================================================================================================================================================================================================================================================================
    
                  daily_price_stdev  annual_price_stdev     price  daily_perc_stdev  annual_perc_stdev  point_size_base  contract_exposure  daily_risk_per_contract  annual_risk_per_contract  position   capital  exposure_held_perc_capital  annual_risk_perc_capital
    JPY                        0.00                0.00      0.01              0.34               5.37       9520364.06           82346.39                   276.15                   4418.38      -1.0  378567.3                      -21.75                     -1.17
    MSCISING                   4.83               77.21    307.65              1.57              25.10            56.07           17249.99                   270.56                   4328.93      -1.0  378567.3                       -4.56                     -1.14
    KR10                       0.36                5.84    119.74              0.30               4.87           619.20           74143.54                   225.82                   3613.16      -1.0  378567.3                      -19.59                     -0.95
    FTSECHINAA               191.31             3060.91  13708.00              1.40              22.33             0.76           10440.41                   145.70                   2331.28      -1.0  378567.3                       -2.76                     -0.62
    NIKKEI400                211.98             3391.61  16275.00              1.30              20.84             0.66           10689.15                   139.22                   2227.55      -1.0  378567.3                       -2.82                     -0.59
    BRE                        0.00                0.03      0.20              1.04              16.62         76162.91           15034.56                   156.18                   2498.86       1.0  378567.3                        3.97                      0.66
    EU-OIL                     6.50              104.07    303.80              2.14              34.26            41.96           12747.52                   272.92                   4366.68       1.0  378567.3                        3.37                      1.15
    CORN                       9.50              152.03    634.75              1.50              23.95            38.08           24172.20                   361.85                   5789.60       1.0  378567.3                        6.39                      1.53
    SILVER                     0.50                7.92     25.96              1.91              30.52           761.63           19771.89                   377.15                   6034.46       1.0  378567.3                        5.22                      1.59
    GOLD_micro                25.86              413.73   1985.40              1.30              20.84             7.62           15121.38                   196.94                   3151.07       3.0  378567.3                       11.98                      2.50
    SOYBEAN                   15.94              254.99   1474.25              1.08              17.30            38.08           56141.59                   606.89                   9710.30       1.0  378567.3                       14.83                      2.57
    IRON                       4.63               74.11    159.85              2.90              46.36            76.16           12174.64                   352.79                   5644.63       2.0  378567.3                        6.43                      2.98
    CRUDE_W_mini               3.97               63.58    100.92              3.94              63.00           380.81           38433.71                  1513.30                  24212.74       1.0  378567.3                       10.15                      6.40
    
    Sum of abs(notional exposure % capital) 113.8
    Sum of abs(annualised risk % capital) 23.8
    Net sum of annualised risk % capital 14.9
    
    Of course this means if the upward march in energies resumes I'm now less likely to benefit; but that's life

    Code:
    ==============================================================================================================================
                                                             Correlations                                                         
    ==============================================================================================================================
    
                   BRE  CORN  CRUDE_W_mini  EU-OIL  FTSECHINAA  GOLD_micro  IRON   JPY  KR10  MSCISING  NIKKEI400  SILVER  SOYBEAN
    BRE           1.00  0.16          0.18    0.09        0.08        0.18  0.10  0.08  0.00      0.05       0.14    0.16     0.13
    CORN          0.16  1.00          0.20    0.05        0.03        0.15  0.16  0.12 -0.08      0.02       0.03    0.13     0.41
    CRUDE_W_mini  0.18  0.20          1.00    0.17        0.07        0.13  0.24  0.02 -0.01     -0.07       0.05    0.15     0.17
    EU-OIL        0.09  0.05          0.17    1.00        0.13       -0.06  0.10 -0.07 -0.07      0.31       0.26   -0.01     0.08
    FTSECHINAA    0.08  0.03          0.07    0.13        1.00        0.10  0.08  0.05 -0.02      0.18       0.21    0.11     0.12
    GOLD_micro    0.18  0.15          0.13   -0.06        0.10        1.00  0.09  0.29  0.08     -0.05       0.04    0.47     0.13
    IRON          0.10  0.16          0.24    0.10        0.08        0.09  1.00  0.01 -0.03     -0.09      -0.08    0.13     0.19
    JPY           0.08  0.12          0.02   -0.07        0.05        0.29  0.01  1.00  0.14     -0.02       0.02    0.24     0.06
    KR10          0.00 -0.08         -0.01   -0.07       -0.02        0.08 -0.03  0.14  1.00     -0.01       0.03    0.06    -0.16
    MSCISING      0.05  0.02         -0.07    0.31        0.18       -0.05 -0.09 -0.02 -0.01      1.00       0.34   -0.01     0.08
    NIKKEI400     0.14  0.03          0.05    0.26        0.21        0.04 -0.08  0.02  0.03      0.34       1.00    0.05     0.07
    SILVER        0.16  0.13          0.15   -0.01        0.11        0.47  0.13  0.24  0.06     -0.01       0.05    1.00     0.10
    SOYBEAN       0.13  0.41          0.17    0.08        0.12        0.13  0.19  0.06 -0.16      0.08       0.07    0.10     1.00
    Interesting that Crude is more correlated with Corn than with European oil equities.

    Rob
     
    Last edited: Mar 10, 2022
    #3297     Mar 10, 2022
    wopr and newbunch like this.
  8. wopr

    wopr

    The timing on this closing trade turned out to be spot on, close to the top of the day :) (I'm assuming times are UTC).
    How did it execute at that time? I know at some point your execution algo was checking that the bid-ask spread is no bigger than X multiples of the minimum tick size. Does your execution try every X minutes and then finally it succeeds when there's enough liquidity that the spread is small enough, or something else?
     
    #3298     Mar 10, 2022
    newbunch likes this.
  9. KevinBB

    KevinBB

    Hello Rob

    I see that in the post above you have 13 DO positions. Are you able to tell us what an average number of positions held at any one time is under DO? Max and Min too, if you are able to do that.

    Thanks,
    KH
     
    #3299     Mar 10, 2022
  10. From the backtest

    https://1.bp.blogspot.com/-8PPER8WM...0wqqDowT3d9Mu8xgCLcBGAsYHQ/s1920/Figure_1.png

    Average (once I have all the markets in my dataset) is probably about 25, max 45

    13 is really low; but then I have 40% of my average risk on so that makes sense

    Rob
     
    #3300     Mar 11, 2022
    KevinBB likes this.