Fully automated futures trading

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

  1. Kernfusion

    Kernfusion

    I guess the only viable approach now is to first call reqContractDetails without specifying LocalSymbol, then filter the results where ContractDetails.Contract.LocalSymbol ends with M or a digit and use that local symbol to request data..
    I guess M means monthly, (which is what we need), and the other options could be D-daily? and maybe W-weekly? But monthly can also be without a letter at all, like "old style"..
    Btw, I only have one instrument like this in my system where I had to specify LocalSymbol, everything else works just by combination of other attributes..
     
    #4621     Jun 30, 2025
  2. Plex134

    Plex134

    I tried this in pysystemtrade using the priced/carry contracts rather than the near and next. The results weren’t as robust, but interestingly, in a cluster analysis it isn’t grouped in divergent, so it may be a bit diversifying. It makes me think trading relative value on the futures curve may also be diversifying.
     
    #4622     Jul 11, 2025
    corsair, danw and globalarbtrader like this.
  3. danw

    danw

    Resolve asset management have published some Webinars and other material on this too that runs multiple carry types together, compares them and concludes to run multiple for diversification.

    Like anything though, we have to try it ourselves with our own system correlations.

    Did you take notice how much performance attribution comes from the short side in your tests?

    I was hoping that carry would have more short side benefit due to many Contango markets but it was similar to trend ie dominated by long side performance.
     
    #4623     Jul 12, 2025
    Plex134 and corsair like this.
  4. corsair

    corsair

    My general observation is that in many of these cases commodities carry (or at least my implementation of it) has become more correlated to trend over time. Take natgas for e.g. the persistent contango ends up dominating the back adjusted return and get picked up by trend.
     
    #4624     Jul 13, 2025
  5. danw

    danw

    Thanks yeah I was guessing the same.

    The fact that my backtest covers periods with large inflation, large extended upside moves and limited downside moves probably explains why shorts perform worse (returns coming from trend components even if using a carry signal).

    Even with contango, I'm guessing the amount of contango isn't strong enough to offset the effect of upside trends in the last 30 year period unless it's a more extreme market like the front contracts of NG or VIX.

    I have fairly long lookbacks/hold times which probably doesn't help the short side too.
     
    #4625     Jul 13, 2025
  6. I reached out to Boons and Prado and they recommened this paper on relative carry(https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3404561). I didn't think it was compelling enough to implement (or even backtest). Basis momentum seemed to work better in spreading trades.

    The issue with spreading trades is that they have much lower risk so require much more trading costs / leverage (with the leverage potentially increasing tail risk). @globalarbtrader has a chapter on it in AFTS that is probably worth a review.

    I follow the huristic of just trying to enter the futures contract (within an instrument) that has the highest or lowest level of carry (depending on if I am long or short). Doing so is equivelant of taking the directional long-short trade my system tells me to take + a spreading trade along the term structure.
     
    #4626     Jul 13, 2025
    Plex134, corsair, danw and 1 other person like this.
  7. klander

    klander

    Hi guys, one noob question about margin requirements:

    IB's interface shows an Initial Margin and a Maintenance Margin at the account level. When in Tactic 3 in AFTS it says that margin usage should be around 30%, does this mean that the Initial Margin should be 30% of the deposited cash in the account? Or is it the Maintenance Margin?

    Also, when rolling a future position, do you need to meet the maintenance margin for that contract (as you are actually "maintaining" a position with the same number of contracts) or do you need to meet the initial margin again?


    Thanks!
     
    danw likes this.
  8. IB considers the new contract as something else than the previous contract. So the initial margin is used.
     
    klander and danw like this.
  9. danw

    danw

    What most margin explanations don't explain, is that initial margin isn't just the margin for a new position that is trying to be opened. It's the initial margin for all your existing positions + initial margin for the new position.

    So effectively we should only really look at initial margin, unless we intend to never change our positions. Maintenance margin is what's required for holding overnight, but as soon as you want to change something the whole lot has to meet all the initial margin requirements. In IB I believe "current available funds" shows how much initial margin can be spent on new positions, whereas "current excess liquidity" is the unused maintenance margin before you get into deep trouble.

    Rob can correct me if I'm wrong, from memory I think it meant 30% of your account but it will depend how much vol & leverage you use. That doesn't have to be cash depending on what type of account you have, eg some portfolio margin accounts that can use other collateral like ETFs, TBills etc but I hear different things from people in different countries. Watch your cash when you open a position and if it doesn't go down then you can do other things with that cash like earn interest.
    Another section in tactics talks about the option to keep part of the cash outside the broker, and account for it in the system account size.

    I did a little margin simulation at one stage, and found out for normal markets (not super volatile stuff like BTC or VIX) there was an approx ATRxPointCost that was very close. I think it was something like 4-4.5 ATRs. IB publish a list of margins on their site you can scrape and run a more detailed simulation, but normally we shouldn't come close to running out.
     
    klander likes this.
  10. klander

    klander

    Thank you for your answers, danw & HobbyTrading!