Fully automated futures trading

Hi Rob,

Great talk last night! Would love to see that as a blog post so I can go over it in detail!

Thank you for all of this, I've learnt so much from you.
 
Hi Rob,

I've decided to try building your system from the ground up, as I figured this would be a good exercise to understand it properly.

I've been using your book/blog, and I'm stuck on the forecast weights. I've calculated the individual EWMAC forecasts, scaled them to have a mean forecast of +/-10, and clipped them to +/-20. Now I'm trying to combine them with a weighted average, but I can't figure out the weights.

I'm guessing I want to downweight highly correlated forecasts and upweight uncorrelated ones.

What I can't tell here is if I'm supposed to do a calculation with the correlation matrix, or use bootstrapping in order to get the weights to combine the forecasts?

(I've attached a PDF of my ipython notebook as ET won't let me upload it directly).

Thanks!
 

Attachments

Hi Rob,

I've decided to try building your system from the ground up, as I figured this would be a good exercise to understand it properly.

I've been using your book/blog, and I'm stuck on the forecast weights. I've calculated the individual EWMAC forecasts, scaled them to have a mean forecast of +/-10, and clipped them to +/-20. Now I'm trying to combine them with a weighted average, but I can't figure out the weights.

I'm guessing I want to downweight highly correlated forecasts and upweight uncorrelated ones.

What I can't tell here is if I'm supposed to do a calculation with the correlation matrix, or use bootstrapping in order to get the weights to combine the forecasts?

(I've attached a PDF of my ipython notebook as ET won't let me upload it directly).

Thanks!

I think there is some confusion here. You can eithier do a single period optimisation or bootstrap. In both cases you get some data and calculate a correlation matrix (and optionally some expected returns although I don't bother) from which you work out the optimal weights. The difference is with bootstrapping is that you take sub samples and work out the weights on each of those before taking an average; with single period you do the whole thing just once.

http://qoppac.blogspot.co.uk/2015/10/a-little-demonstration-of-portfolio.html

GAT
 
It's probably easier to show you my code.

Code:
def breakout(x, ws):
  max_x=pd.rolling_max(x, ws, min_periods=min(len(x),int(ws/2)))
  min_x=pd.rolling_min(x, ws, min_periods=min(len(x), int(ws/2)))
  sig=[breakout_one_row(idx, x, max_x, min_x) for idx in range(len(x.index))]
  sig=pd.TimeSeries(sig, index=x.index)
  sig=pd.ewma(sig, span=int(ws/4.0), min_periods=int(ws/8.0))
  return sig

def breakout_one_row(idx, x, max_x, min_x):
  r_px=x[idx]
  r_min=min_x[idx]
  r_max=max_x[idx]
  return 4*(r_px - mean([r_min, r_max]))/(r_max - r_min)



I'd do it by pooling across instruments (by coincidence just blogged on this http://qoppac.blogspot.co.uk/2016/01/pysystemtrader-estimated-forecast.html)

Hi GAT,

Do you vol standardise your breakout rule?
 
I'm up to bootstrapping trading rules on single instruments with rolling windows.

I've been writing my code from scratch to better understand it, only looking at pysystemtrade for clues.

I have one problem. I wrote my accountCurve using a walk-forward backtester. It's extremely slow, so even a simple bootstrap with limited scope takes several hours, despite having multithreaded the optimisations.

I noticed in your code that you use a vectorised implementation based on statistics, but I'm struggling to understand why it works. Would you mind explaining it, as if I were five years old?

Thanks a million! :)
 
Back
Top