Futures returns

Mark17

Member
Hi all and Happy Holidays!

I'm trying to build a futures backtester and I want to brainstorm a bit about calculating returns. I haven't traded futures yet, but I'm trying to give myself reason to. I want this backtester to compare portfolios of stock only with stock and other futures. I'm starting with ES, CL, GC, EC, and US.

The big question is: how would I compute returns in an apples-to-apples manner to ES alone?

First thought: some futures markets seem to be more straightforward than others. Of those I mentioned, ES, CL, and GC are linear scales. I guess EC is too? US is a percentage of something and I'm not clear on that.

But maybe, for each of these, it's just as simple as calculating price change * multiplier (varies by market) and dividing by what I deem to be the margin requirement.

Margin requirement is tricky because it varies over time. What I'd like to use is the largest margin requirement over the last, say, 10 years--and possibly go even a bit higher. I could base this on max futures price during the time interval and take a percentage of that (I wasn't able to find any datasets with margin requirements for multiple futures markets), but this will vary by simulation and I'm not sure this preserves my hope for normalized comparisons. If I went this route, then maybe I take one contract for each market.

Wouldn't this run into volatility issues, though? Maybe I should calculate number of contracts based on some volatility measure? More volatile markets, in other words, would be traded with a smaller number of contracts. Can I do a normalized comparison this way, though? Also, volatility does expand and contract over time, which would affect the position sizing... would this still be okay for a normalized comparison?

Zooming out a little and building on that concept, how would the normalization concept work if I were to run simulations where, for example, 5 of 10 potential futures markets were chosen to make a portfolio?

Any thoughts--even partial ones--are appreciated!
 

AndrewS

Member
Stock is normally used as a longer term investment such as buy and hold. Futures are much more a trading vehicle that require some type of strategy even if it's just to roll a long only portfolio.
 

Tb2018

Member
Mark 17 ,IMHO if you are asking this kind of questions....probably you are not ready to run and make use of the "futures backtester" and
can even be a step in the wrong direction (building wrong or false convictions about the market!).What I suggest instead is to study in detail the instruments (futures,stocks,index,options ,etf's .....etc etc.) to gain a deep understanding of the way they could be integrated in any strategy.
Otherwise you risk to build a castle on very weak foundations.
 

Mark17

Member
Mark 17 ,IMHO if you are asking this kind of questions....probably you are not ready to run and make use of the "futures backtester" and
can even be a step in the wrong direction (building wrong or false convictions about the market!).What I suggest instead is to study in detail the instruments (futures,stocks,index,options ,etf's .....etc etc.) to gain a deep understanding of the way they could be integrated in any strategy.
Otherwise you risk to build a castle on very weak foundations.

What exactly could generate wrong/false convictions about the market and what kinds of wrong/false convictions are you thinking of?

One of the reasons for doing this is precisely to gain a deeper understanding of how they may be integrated to a portfolio.
 

Tb2018

Member
Mark 17,I'll keep it short:

Study first the fundamentals of each market you intend to trade -----The list will be too long ..but don't forget
how the orders are executed and who are the market players,(futures:cost of carry,contango/ backwardation etc. etc).
My point is ... from what you asked I think you need to understand the fundamental first before you backtest any kind of "system".

Happy New Year

Tom
 

Tb2018

Member
For Mark17 Ps :In 30 years as a professional trader I never met any pro trader talking Technical analysis ,but all the most successful at the top had
perfect knowledge of the market they traded.
And if you want to have fun with your "system" (NOW) and study later! use equivalent ETF'S instead they have already done all the calculations needed for the retail customer to use).
Tom

 
Last edited:

Mark17

Member
For Mark17 Ps :In 30 years as a professional trader I never met any pro trader talking Technical analysis ,but all the most successful at the top had
perfect knowledge of the market they traded.
And if you want to have fun with your "system" (NOW) and study later! use equivalent ETF'S instead they have already done all the calculations needed for the retail customer to use).
Tom


I would debate this with you, Tom, but I doubt there would be a clear-cut winner due to things like operational definitions, lack of documentation/proof, limited sample size/anecdotal findings, unverifiable claims, etc. From where I sit, I don't really believe in fundamentals and neither do a lot of algo traders I see. I'm not to the point where I believe in algo trading either, though, or technicals. I also don't believe in "perfect knowledge."

None of this is really necessary for the backtester I'm building, though. I may or may not find something... but I can't believe hollow claims by others in this industry. If I want to see whether something works, then I need to test it for myself.

Do you have any comments about whether ETFreplay suffers from future leaks?

Part of my reason for doing this is to gain experience with Python, too.

Thanks!
 

Marcas

Active member
Mark17, I think I understand where you're coming from. With futures, especially commodities, fundamentals matter more then in equity markets. It is not so easy to manipulate futures on a long term (but it also can be done). You need to know who the main players are and monitor them. This is not some theory but practice of trading.

I'm, in general, opponent to relaying trades on BT but wish you luck. Wonder what data do you use.

If you are in Py you may want to check old Capital Discussion Slack. Can't provide link because Salck is down today.
 

Mark17

Member
Mark17, I think I understand where you're coming from. With futures, especially commodities, fundamentals matter more then in equity markets. It is not so easy to manipulate futures on a long term (but it also can be done). You need to know who the main players are and monitor them. This is not some theory but practice of trading.

I'm, in general, opponent to relaying trades on BT but wish you luck. Wonder what data do you use.

If you are in Py you may want to check old Capital Discussion Slack. Can't provide link because Salck is down today.

Especially for a project like this, I only care about signals that can be objectively programmed. Then, strategy performance is either statistically significant or not and if not, move on and try the next one.

I think this is turning out to be more a question about programming than it is about backtesting function--especially for a Python newbie like myself. I have begun the project, but it's awful slow (~8 seconds per 2-year simulation across five markets). I need to do a lot of thinking about how to cut down on the speed and that probably means breaking down the code into tasks and figuring out how to make it flow most efficiently. Why iterate over 504 rows 2-3 times if I can somehow do it just once, for example? But how to do it just once? These are all hard questions. I see there are a few articles online that talk about building a backtester and some general guidelines about what to include. They border on being over my head for now, but hopefully with time and effort they won't be.
 
Top