Fully automated futures trading

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

  1. maciejz

    maciejz

    GAT, Thanks for your reply.
     
    #171     Sep 25, 2015
  2. Raphael

    Raphael

    This thread is really interesting. Thank you for sharing your experience. Your book is a great read as well.

    One question, at what point will margin calls become an issue on your portfolio? Would this only happen if you have a 100% drawdown or could you be subject to this sooner? If so how do you manage the risk of a margin call?
     
    #172     Oct 3, 2015
  3. Things are confused by the fact that I have both stock and cash funding my portfolio, and because I have 'too much' in my account. Let's pretend that I had 100% cash funding:

    Balance sheet

    Account value: 390K
    Cash: 390K
    Margin: 120K (31% of available cash)

    Capital at risk is 390K (reflecting a 2.5% drawdown on maximum capital at risk of 400K)

    Now let's suppose I have an 'extreme' level of risk; targeting twice my long run average expected risk of 25% x 390K = 97.5K a year, or 6.1K a day. In this case I'd probably be using about 195K of margin (pro-rata based on what my current expected risk is)

    Account value: 390K
    Cash: 390K
    Margin: 195K (50% of available cash)

    Let's take an extreme day when I lose 10 sigma on twice my average risk; or 122K (a 31% one day loss); in a 'gap' when I don't have the chance to sell down any positions.

    That would reduce my cash and capital at risk 390 - 122 = 268K,

    Account value: 268K
    Cash: 268K
    Margin: 195K (72% of available cash)

    However at the first opportunity my positions would reduce by 1 - 268/390 = 31%, and my margin usage would fall by 31% to 134K (back to 50% of cash)

    (It's likely that my positions would reduce further due to elevated volatility and trends being reversed, but it's hard to quantify what effect this would have, so I'm going to ignore this effect).

    Average long run expected risk has also fallen by 31% to 4.2K.

    Account value: 268K
    Cash: 268K
    Margin: 134K (50% of available cash)

    Suppose we have another 10 sigma day and lose 10 x 2 x 4.2 = 84K.

    Cash and capital at risk to 268 - 84 = 184K

    Account value: 184K
    Cash: 184K
    Margin: 134K (72% of available cash)

    Again then positions would reduce by 1 - 184/268 = 31%, margin usage to 92K (again, 50% of cash).

    Average expected risk is 2.9K a day.

    Account value: 184K
    Cash: 184K
    Margin: 92K (50% of available cash)

    Another 10 sigma day; lose 57K:

    Account value: 127K
    Cash: 127K
    Margin: 92K (72% of available cash)

    Again positions reduce by 31%, margin usage falls to 63K (50% of capital).

    Basically because I'm reducing my positions proporportionally as I lose money I will always be using 50% of my remaining cash for margin. So I should never be in a position where a margin call causes me problems; unless I get hit by an extremely large gap.

    For example if at any point I lost more than 40% before I got a chance to reduce my positions, then I'd have some forced liquidation.

    My maximum expected risk (at double the long run average) is 50% a year, or 3.1% a day. That means I'd need to see a 13 sigma day before hitting a margin problem. I'm comfortable that is pretty unlikely. Not as unlikely as the gaussian distribution suggests (incalculably small); October 87 was a 20 sigma event but with a large diversified portfolio twenty sigma is pretty unlikely and even 13 sigma should be fairly rare.

    But suppose I was aiming for a much higher risk; and/or had a strategy that consumed more margin. Imagine you had 90% of your capital used for margin; and you were targeting 100% annualised volatilty. Then a mere 1.6 sigma event would wipe you out....

    GAT
     
    #173     Oct 4, 2015
    Raphael likes this.
  4. Raphael

    Raphael

    That makes a lot of sense. Thank you.
     
    #174     Oct 4, 2015
  5. Update (last update was 22nd september). I'm up about 7% of capital, or 28K. I also hit a new HWM on Friday; which was nice.
    [​IMG]
    Current drawdown is 3.8% (off new HWM).

    I'm also back above the key pyschological point where I have made more money than I have at risk (400K; well actually 96.2% of 400K to be pendantic due to the DD). It's interesting to speculate about these key points. For example once I made 300K I had doubled my starting capital. If I make another 45K or so this year I'll be at 100K for the year; which would be a Sharpe Ratio for the year of 1.0 (although the actual figure could be different depending on the exact monthly/weekly/daily ups and downs). If I lose 185K then I will be in a 50% drawdown.

    Do these points have more effect on discretionary trader behaviour than key price points? It's an interesting point, but it's not obvious how we would model them and use them in a predictive sense.

    I just did my 6 monthly accounts. My net worth is pretty much unchanged; to put it another way the profits from my futures trading covered the losses in my long only stock and bond portfolio, with enough left over to pay for my living costs. Trend following is a nice hedge (as discussed here).

    I also just bought a new backup machine (intense pc) which is proving to be fantastic. I would have bought another mint box but they seem to have run out of UK stock. This is pretty much identical; so now both my machines are of similar spec (before ) and I can swap them more frequently which is obviously safer.

    There are some new interviews here and a couple of new book reviews here. (near the bottom of each page)

    Gainers:

    Crude +6.1K
    Plat 3.2K
    Pallad 2.2K
    JPU 1.2K
    KOSPI 1.4K

    Losers:

    SP500 -1.8K
    KR3 -1.2K
    Livecow -1.1K
    Wheat -1K

    Positions:

    Code:
           code contractid  positions   Lock WrongContract InFwdNotRoll
    0       AUD     201512         -1  False         False        False
    6      BOBL     201512          4  False         False        False
    25      BTP     201512          3  False         False        False
    4      BUND     201512          1  False         False        False
    18   COPPER     201512         -2  False         False        False
    17     CORN     201612         -2  False         False        False
    11  CRUDE_W     201512         -2  False         False        False
    16  EDOLLAR     201903          3  False         False        False
    23  EDOLLAR     201812         10  False         False        False
    20      EUR     201512         -1  False         False        False
    24  EUROSTX     201512        -13  False         False        False
    3    GAS_US     201512         -5  False         False        False
    9       GBP     201512         -3  False         False        False
    10     GOLD     201512         -1  False         False        False
    15     KR10     201512          2  False         False        False
    13      KR3     201512          9  False         False        False
    1   LEANHOG     201606          3  False         False        False
    21  LIVECOW     201610         -2  False         False        False
    8       MXP     201512         -5  False         False        False
    14      NZD     201512         -2  False         False        False
    19      OAT     201512          1  False         False        False
    27     PLAT     201601         -3  False         False        False
    2      US10     201512          1  False         False        False
    12      US2     201512          2  False         False        False
    22      US5     201512          2  False         False        False
    5       V2X     201512          1  False         False        False
    26      V2X     201511          3  False         False        False
    7     WHEAT     201612         -2  False         False        False
    
    Risk:
    Code:
    Expected annual risk more than GBP6400 per year, GBP400 per day
           code  multisignal  expected_annual_risk  expected_annual_risk_per_contract  position  expected_annual_risk_rounded_pos
    28      MXP        -15.3                 10088                               2248        -5                             11242
    25      EUR        -12.8                  8474                              11307        -1                             11307
    31     GOLD        -10.4                  6843                              11624        -1                             11624
    2   LIVECOW        -19.5                 12895                               5846        -2                             11692
    29      NZD        -15.4                 10159                               5967        -2                             11934
    26      GBP        -22.6                 14895                               4841        -3                             14524
    30   COPPER        -33.7                 22256                              11268        -2                             22537
    33     PLAT        -31.9                 21068                               7569        -3                             22706
    35   GAS_US        -37.3                 24661                               4823        -5                             24113
    34  CRUDE_W        -32.4                 21413                              12360        -2                             24721
    5      KR10         10.6                  7012                               3156         2                              6312
    6       KR3          9.8                  6497                                725         9                              6529
    7      BOBL          9.8                  6501                               1767         4                              7069
    10      OAT         13.7                  9068                               7319         1                              7319
    1   LEANHOG         12.9                  8486                               2727         3                              8180
    36  EDOLLAR         29.4                 19423                               1456        13                             18929
    8       BTP         31.0                 20465                               6558         3                             19674
    
    It's interesting how few longs I have nowadays. Right now isn't a great time to be a long only investor.

    Trades:
    Code:
             code contractid     filled_datetime  filledtrade  filledprice
    5527      AUD     201512 2015-09-24 07:59:12           -1     0.695300
    5590     BOBL     201512 2015-09-29 07:35:46            1   129.100000
    5533      BTP     201512 2015-09-24 08:22:20            1   135.840000
    5716     BUND     201512 2015-10-05 07:35:34            1   157.130000
    5536      CAC     201510 2015-09-24 08:24:34           -1  4410.000000
    5695      CAC     201510 2015-10-01 08:04:58            1  4507.500000
    5470   COPPER     201512 2015-09-18 16:07:57            1     2.383500
    5539   COPPER     201512 2015-09-24 12:01:34           -1     2.296000
    5626     CORN     201612 2015-09-30 15:05:08            1   413.000000
    5710  CRUDE_W     201512 2015-10-01 16:58:30           -1    45.740000
    5461  EDOLLAR     201812 2015-09-18 12:13:41           -1    97.970000
    5485      EUR     201512 2015-09-23 01:11:12           -1     1.113100
    5473   GAS_US     201512 2015-09-18 18:18:02           -1     2.842000
    5608   GAS_US     201511 2015-09-30 12:06:30            2     2.588000
    5611   GAS_US     201512 2015-09-30 12:06:30           -2     2.763000
    5614   GAS_US     201511 2015-09-30 12:17:48            2     2.581000
    5617   GAS_US     201512 2015-09-30 12:17:48           -2     2.757000
    5452      GBP     201512 2015-09-18 01:52:52            1     1.556400
    5488      GBP     201512 2015-09-23 05:45:36           -1     1.534100
    5560      GBP     201512 2015-09-25 02:05:46           -1     1.521400
    5587      GBP     201512 2015-09-29 06:27:38           -1     1.516100
    5458     GOLD     201512 2015-09-18 12:05:03            1  1136.500000
    5476     GOLD     201512 2015-09-21 12:04:49            1  1137.100000
    5701     GOLD     201512 2015-10-01 12:10:14           -1  1112.300000
    5449      KR3     201512 2015-09-18 01:45:36           -2   109.620000
    5455      KR3     201512 2015-09-18 04:49:37           -1   109.650000
    5596      KR3     201512 2015-09-30 01:53:55            1   109.830000
    5692      KR3     201512 2015-10-01 03:55:49           -1   109.830000
    5584  LEANHOG     201606 2015-09-28 15:43:30            1    79.675000
    5479  LIVECOW     201610 2015-09-21 16:14:37           -1   131.375000
    5491      OAT     201512 2015-09-23 07:08:36            1   151.860000
    5542   PALLAD     201512 2015-09-24 12:02:21            1   645.100000
    5602     PLAT     201510 2015-09-30 12:02:45            1   925.500000
    5605     PLAT     201601 2015-09-30 12:02:45           -1   926.300000
    5620     PLAT     201510 2015-09-30 12:23:13            1   923.700000
    5623     PLAT     201601 2015-09-30 12:23:13           -1   924.500000
    5707     PLAT     201601 2015-10-01 16:54:55           -1   910.200000
    5593      SMI     201512 2015-09-29 08:07:13           -1  8245.000000
    5599      SMI     201512 2015-09-30 11:25:00            1  8484.000000
    5464  SOYBEAN     201611 2015-09-18 12:30:07            1   882.000000
    5557  SOYBEAN     201611 2015-09-24 12:15:37           -1   872.750000
    5581  SOYBEAN     201611 2015-09-28 12:29:13            1   891.250000
    5530     US10     201512 2015-09-24 06:53:05            1   128.031250
    5467      US2     201512 2015-09-18 15:54:06           -1   109.382812
    5704      US2     201512 2015-10-01 14:12:12            1   109.531250
    5713      US2     201512 2015-10-02 15:13:50           -1   109.703125
    5629      US5     201512 2015-09-30 15:15:53            1   120.468750
    5698      V2X     201512 2015-10-01 11:56:49            1    24.800000
    Slippage: £402 vs expectations of £208

    Ouch. I had a bad AUD and GBP trade which caused most of the problems here. Looking at the chart it looks as though the price I had when I submitted the order was stale. So it's bad data rather than a gap. Hopefully these should even out over the year so I don't have to go through the effort of manually cleaning them out of the database. Due to latency these figures can only ever be an estimate.

    GAT
     
    #175     Oct 5, 2015
  6. Raphael

    Raphael

    With this in mind, if someone had all of their capital in a trading system, would it be worth including 'buy and hold' as one of the strategies to add diversity, in addition to other strategies like trend following and carry?
     
    #176     Oct 6, 2015
  7. Yes. I would put perhaps half my portfolio in a long only (or what I call the 'one rule' rule in my book) investment in "things that I expected to produce a positive return:" equities, bonds, short vol, perhaps some gold as an inflation hedge.

    GAT
     
    #177     Oct 6, 2015
  8. Raphael

    Raphael

    I've been reading and coding up the framework you describe in your book.

    One question: when computing costs you use the volatility normalized turnover. If this is calculated in backtesting do we simply compute the number of instrument blocks traded at each specific date, divide this by the instrument volatility at that date, divide it by two so that it's a count of the number of round trips, and then sum the results over an entire year?

    This annual volatility normalized turnover would then be multiplied by the standardized cost for the instrument and subtracted from the pre-cost SR. Is this the correct process?

    I tried to follow this in the book but wasn't completely sure.

    Thank you!
     
    #178     Oct 14, 2015
  9. Hi

    Turnover is basically trades / 2 x absolute average position

    From page 186 of the print edition (chapter 12 'Estimating the number of round trips'):

    Turnover=
    Average number of blocks traded per year / (2 x average absolute number of blocks held)

    So suppose your block is one futures contract and you trade daily. If your series of positions is p0, p1, ... pt
    and you have N years of trading history then turnover=

    (1/N)*(abs(p1-p0)+ans(p2-p1)+ ... ans(pt - pt-1)) / (2 x mean(abs(p0), abs(p1), abs(p2), ....)

    I can also write this more conveniently as 250 (# of business days in a year) times the average daily turnover:

    (250)*(mean(abs(p1-p0)+ans(p2-p1)+ ... ans(pt - pt-1)) / (2 x mean(abs(p0), abs(p1), abs(p2), ....)

    Now for long backtests this might not be too accurate, especially if volatility has changed a lot over time. I can also rewrite the above as

    (250)* ([abs(p1-p0)/ (2 x P0)] + [abs(p2-p1)/ (2 x P1)] + ....[abs(pt-pt-1)/ (2 x Pt-1)]

    Where P is a smooth moving average of absolute position

    (technically this is not exactly equal to the previous expression, but takes a moving average rather than one over the whole backtest)

    Or I could also write:

    (250)* ([abs(p1-p0)/ 2 x A0] + [abs(p2-p1)/ 2 x A1] + ....[abs(pt-pt-1)/ 2 x At-1]

    Where A0... is the position I would get with a forecast of +10 given the vol etc at that time (the 'no rule' rule position).

    [Recall that any position = instr. weight * IDM * forecast * daily cash vol target / ( 10 * price vol per day * block value * fx rate )

    And for A0.... At-1 the forecast is +10]

    This is probably the best estimator, . Notice that if we're measuring the turnover of a FORECAST, rather than a final position, this becomes: (for forecast f1.... ft)

    (250)* ([abs(f1-f0)/ 2 x 10] + [abs(f2-f1)/ 2 x 10] + ....[abs(ft-ft-1)/ 2 x 10]

    Hope that makes sense
    GAT
     
    #179     Oct 14, 2015
  10. Raphael

    Raphael

    From what you've written it seems like you're estimating trading costs using this approach, rather than just computing them directly. There are a few things I can't follow here:

    1. The trading costs are in terms of normalized turnover. I thought this turnover was volatility normalized, but from what you've written above the turnover seems to be normalized by the average absolute number of blocks held. Is the average absolute number of blocks held equal to the volatility? Is the standardized cost also normalized in terms of average absolute number of blocks held?
    2. Wouldn't it just be simpler to price in the cost of trading directly in the account currency, e.g. if 10 blocks of an instrument are bought on a particular day, and the cost per block is $8 (bid-ask spread + commission), then just subtract $80 from the account value at the end of the day in the back test. What advantage does using the normalized turnover and standardized cost have over this simple approach?
     
    Last edited: Oct 14, 2015
    #180     Oct 14, 2015