A tale of two positions

Discussion in 'Commodity Futures' started by globalarbtrader, Jul 8, 2015.

  1. Uh.... yeah I am. From a couple of posts ago you might remember that I said I use:

    "....a 35 day exponentially weighted moving average of daily returns."

    That's pretty close to bloomberg, although as I said I'm using an average of those estimates over a year for the purposes of cost calculation, wheras they clearly have only the most recent measure.

    For interest on my most recent measure of vol I have corn at $7.2 a day and soya at $15.68 (so almost exactly twice, same as in my cost calculation); with prices of $434 and $992 respectively that comes out to annual percentage vol of 27% for corn and 26% for soya.

    That still doesn't get me to bloomberg's levels, but I'm pretty confident that the calculation is correct (the actual vol calculation is done by a python library, not by my code), and just eyeballing the chart's it doesn't look unreasonable for them to have the same percentage vol, given they both rallied about 20% in the same period.

    Anyway bid/ask spread I basically measure by taking snapshots roughly hourly during trading hours. The stuff at the end of this screen dump is the bid/ask for the last few days.

    Code:
    run@bilbo ~/workspace/systematic_engine/sysdiag/scripts $ . showinstrument LIVE CORN
    
    **************************************************************************************
    Instrument code CORN, Corn
    rollcycle Z, pricecycle HKNUZ,  assetclass Ags
    exchange ECBOT, pointvalue 50.000000 currency USD
    lastrolloffset -60 days, firstrolloffset -90 days, carryoffset -1 priced contracts
    
    IBSymbol ZC
    IB factor 1.000000 IB Price exchange ECBOT
    
    Priced contract is 201512, forward is 201612, carry is 201509
    
    Contracts with positions:
    
    [position:-1, code:CORN, contractid:201512;]
    
    Limit data
    {'maxdonetoday': 0, 'maxposition': 20, 'lastaccess': Timestamp('2015-07-09 06:05:15'), 'maxorderoneday': 5, 'maxorderall': 1000, 'maxdoneall': 54}
    
    Size
    2015-07-06 16:04:52     28
    2015-07-06 17:05:12     29
    2015-07-06 18:05:32     31
    2015-07-07 14:43:09     34
    2015-07-07 15:43:31     18
    2015-07-07 16:43:49    123
    2015-07-07 17:44:16    103
    2015-07-08 15:16:44     27
    2015-07-08 16:17:13    118
    2015-07-08 17:17:36     23
    2015-07-08 18:18:06      8
    2015-07-09 14:02:21      5
    2015-07-09 15:14:36     38
    2015-07-09 16:15:03     65
    2015-07-09 17:15:37    235
    dtype: float64
    
    2015-07-06 16:04:52    0.25
    2015-07-06 17:05:12    0.25
    2015-07-06 18:05:32    0.25
    2015-07-07 14:43:09    0.25
    2015-07-07 15:43:31    0.25
    2015-07-07 16:43:49    0.25
    2015-07-07 17:44:16    0.25
    2015-07-08 15:16:44    0.25
    2015-07-08 16:17:13    0.25
    2015-07-08 17:17:36    0.25
    2015-07-08 18:18:06    0.25
    2015-07-09 14:02:21    0.00
    2015-07-09 15:14:36    0.25
    2015-07-09 16:15:03    0.25
    2015-07-09 17:15:37    0.25
    dtype: float64
    
    **************************************************************************************
    
    
    I take the median (more robust than the mean) of half these spreads over the period I'm calibrating for, say a year.

    I compare this to what I actually achieve in trading over the same period (which is obviously a lot noisier measure, and biased downwards due to my execution algo making me money on average) as a sanity check. For corn my median fill price was 0.125 to the mid of slippage, which obviously equates to the same level as I get from hourly sampling above. Note that the standard deviation of my slippage on actual trades was 1.74 ticks versus 0.055 for the hourly samples so you can see using trades is a much noisier measure (partly because there are many fewer trades than there are samples).

    So I've got: (Average spread over 12 months plus average commission paid) divided by average of 35 daily return volatility, again over 12 months.

    Hope this makes sense.

    GAT
     
    Last edited: Jul 9, 2015
    #11     Jul 9, 2015
  2. re: "average of those estimates over a year for the purposes of cost calculation, wheras they clearly have only the most recent measure"
    Exactly, and it doesn't make sense as an input to a trading system unless your average time-in-trade is several months....or years.
    It's like a HFT algo using the average of the inside BID/ASK of the DOM for the last few days...
    it has no relevance due to it's "age".
     
    #12     Jul 9, 2015
  3. Okay I think you have misunderstood....

    To size positions I use 35 day ewma based on daily returns. That makes sense given my holding period of between 2 weeks and 6 weeks (and this was studied at great length by myself and others in my last fund - there is no difference using a much faster or slower look back and after costs faster estimates get killed). The numeric figures I quoted in my last post were the most recent estimates of vol using that measure.

    To calibrate my trading system which I only do annually I take the average of those vol estimates over a 12 month period. It would make no sense to use the most recent vol for that.

    Maybe some one else can chip in and let me know if this is making sense....
     
    #13     Jul 9, 2015
  4. re: "to calibrate my trading system which I only do annually I take the average of those vol estimates over a 12 month period. It would make no sense to use the most recent vol for that."

    I understand, but I dispute this given that average time-in-trade.
     
    #14     Jul 9, 2015
  5. So... often should I recalibrate? And using what length of vol?

    Is it clear what recalibration actually involves? By the way it usually results in almost no change to the forecast weights
     
    #15     Jul 9, 2015
  6. bone

    bone

    Actually, the trading exchange itself has the most sophisticated volatility scanning ability on planet earth. And as of today, in terms of inter market margins, they assign a hedge ratio of 2 Corn versus 1 Soybean, and they assign a margin credit of only 50% ( which is really weak as far as spreads go ). The low margin credit assignment from the exchange tells me that there is considerable co-integration risk with respect to the products you have chosen.

    http://www.cmegroup.com/trading/agr.../corn_performance_bonds.html?marginsTab=INTER
     
    #16     Jul 9, 2015
  7. Okay so the hedge ratio is exactly in line with my measure of current volatility (which is what I use to size my positions), and also coincidentally with the 12 month measure I use to calibrate my system.
     
    #17     Jul 10, 2015
  8. Perhaps I should be clearer:

    Broadly speaking a system of this type consists of a bunch of indicators. Let's keep it simple and assume we just have three - a fast moving average crossover, a medium speed one, and a slower one. To decide my position I take a weighted average of the value of their forecasts, and then scale for volatility and my account size. The volatility I scale with is a 35 day ewma of daily returns. As of last night the vol on Corn was $7.1, and Soybeans $16.6. To put it another way owning a single Corn contract has an annualised risk of $3,672, and Soybeans $8,526.

    As I think (?) we've all agreed the 35 day ewma is about right given my average holding period.

    Right we need to decide what forecast weight to give to each crossover in the weighted average.

    This is the calibration process. Note that the forecast weight's aren't 'part' of the model; they are a set of parameters that dictate how the model behaves. So we aren't using a 12 month average of volatility inside the model itself.

    What information should we use to do this calibration? This will help us work out how often we should do them. This is basically a portfolio optimisation problem. So we might want to consider:

    a- the pre-cost sharpe ratio
    b- the correlation (adjacent crossovers in the frequency space have higher correlation)
    c- the costs (for which I use an average of spreads, and volatility, measured over 12 months)

    Now it is very hard to find truely statistically significant information about (a), even using several decades of daily data across multiple instruments. When you update your calibration there is unlikely to be any new information even if you do it annually. Correlations are more significant; but also don't tend to change very much.

    Costs do change, but the costs measure is relatively noisy, and it doesn't have any predictive stability for short period. If for example I was to remeasure costs and recalibrate every month then I'd be speeding up and slowing down my model.

    Notice also that when we do change these parameters it will cause us to do extra trading as we move from one measure of the model to another. It's also generally a good idea not to keep fiddling with your model as it can lead to implicit overfitting on too little data.

    I hope this makes it clearer how exactly I am using the 12 month average volatility, and that it wouldn't be sensible to use a faster measure for this particular application. Also I hope it's clear that in the main place I use volatility, to size positions, I am using a 35 day measure.

    Again, as it happens, both the 35 day and the 12 month average are currently giving roughly a 2:1 measure in price volatility (or almost the same in % volatility); exactly what the CME measure is.

    GAT
     
    #18     Jul 10, 2015
  9. bone

    bone

    I agree that your hedge ratio coincides with the CME SCAN ratio. Having said that, you are clearly missing the most important issue which you do not appear to have accounted for with respect to the two particular products you have chosen: co-integration risk. There is a similar juxtaposition posed for Gold versus Silver as well as Gold versus Platinum. Your particular strategy can get crushed by co-integration risk. My 2 cents, but if you believe in your strategy completely then please by all means proceed.
     
    #19     Jul 10, 2015
  10. Hi Bone

    It's not obvious whether you think I am (or should be concerned about) underestimating or overestimating the likely future correlation* between these two assets.

    * I understand the difference between cointegration and correlation, as I know do you, but I'm going to use the latter term as it's a concept that is more generally understood; and I don't think the difference is important for the matter at hand - though with a caveat that I will come to briefly below.

    To be clear I am not running an explicit relative value, spread, or whatever you want to call it system here. I'm guessing from the tone of your post that you think I am running one, and that I should be worried about falling correlation / cointegration breaking down.

    If you read the blog post carefully you'll see that a few weeks ago I was actually short both assets; and now I'm quite long Soya and only slightly short Corn. This obviously isn't a spread strategy.

    I have 40 odd futures markets on which I'm independently generating signals and positions. Usually I will have the same sign of position on highly correlated markets. Sometimes I will have the same position on low/negatively correlated markets. Usually I will have the opposite position on low/negatively correlated markets. Sometimes, like now, I will have the opposite position on highly correlated markets.

    Were I running a spread strategy (which I am not) then clearly I'd mainly be concerned with overestimating the correlation. If I say thought the correlation was 95%, and leveraged up accordingly to hit some risk target, and it turned out that the correlation could go to zero or even negative, then I would have massively underestimated my risk and may well get killed.

    (Coming back to cointegration just for one second I'd be concerned in the corner case where the cointegration broke down but the correlation remained high; this wouldn't hurt my risk estimate but would kill my p&l. )

    Okay so I am not running a spread strategy. So what is my exposure to correlation risk?

    To think about this it's worth simplifying the problem and assuming I only have these two assets in my portfolio (I have over 40, which means my exposure to this specific risk is relatively low, but we can leave that aside for a moment).

    What I will do is backtest two trading systems, one for Corn and one for Soyabean. Then I'll look at the correlation of the returns of those systems - not the underlying assets. Suppose for the sake of the discussion that correlation comes out to 80%.

    (Note that if I did have a spread system then the correlation of the system returns would be about minus 80%).

    What I will do with that information is apply a leverage factor to my portfolio to ensure that the expected risk is what it should be. With 50:50 portfolio weights that factor will come out relative low, around 1.05. For comparision if the two assets were completely uncorrelated the factor would of course be square root of 2, 1.41.

    (Again if I had a spread system the factor would be much, much higher)

    Now I move to actual trading. What will happen if:

    - If I am long both Soya and Corn*, and correlations are similar to historical levels, then I'll expect to achieve roughly the long run average portfolio risk.
    - If I am long both Soya and Corn*, and correlations are much higher than normal, then I'll have a higher portfolio risk than normal. However the maximum this extra risk can be**, if correlations go to one, is 5% more than average (the amount of leverage I took on assuming that correlations were not one).
    - If I am long both Soya and Corn*, and correlations are much lower than normal, then I'll have a much lower portfolio risk than normal.

    * also assuming that the forecast for both assets is at long term average values, but that's not important.
    ** ignoring unexpected spikes in volatility

    That's the more common case. Very occasionally I will have the opposite position on, like over the last week or so. So:

    - If I am long Soya and short Corn***, and correlations are similar to historical levels, then I'll achieve much less risk than on average
    - If I am long Soya and short Corn***, and correlations are much higher than normal, then I'll have almost zero risk.
    - If I am long Soya and short Corn***, and correlations are much lower than normal, I might briefly have higher risk than on average if correlations go negative.

    *** assuming for fun that the forecast for both assets is identically opposite, although that wasn't the case in reality.

    In the final case bear in mind that I'm trend following the individual assets.

    So if correlations went negative with a long/short position then eithier I'd be making money on both positions, or losing it on both. In the former case, great. In the latter case I'd cut my position (ignoring the difference in trading speed that's occupied most of the thread).

    If correlations went up or remained high with a long/short position then I'd be losing money on one position and cutting it (as happened with Corn), and gaining on the other (and increasing it, like with Soya). The long/short wouldn't last very long.

    The longwinded summary of all of this is that a spread trader wants high correlation (or yes, to be precise, cointegration) and is scared of falling correlations. A directional trader like myself wants low correlation (a portfolio of nicely diversified assets on which they will leverage up to hit a risk target) and is scared of rising correlations. For the latter the assets they worry about are not those they know / assume are correlated like the grain complex; but those that they assume are diversifying until they are not (like when QE stops; won't all financial assets go down together?).

    GAT

    [Postscript: I also have risk limits that will reduce my risk if (a) my total expected risk based on correlations over the last 6 months is too high, (b) my total expected risk assuming all assets are fully correlated goes above a certain level, and (c) my total expected risk, assuming all volatilities go to historic highs at the same moment, goes above a trigger point. (b) is essentially my protection against correlation risk]
     
    #20     Jul 10, 2015
    .sigma likes this.