Profile Picture

Backtesting strategies that require actual future contracts

Posted By lampalork 2 Years Ago

Backtesting strategies that require actual future contracts

Posted Monday August 07 2017
Hi All,
I'm relatively new to RightEdge. I have searched the forum but i could not find exactly what i'm looking for. Sorry if i'm asking the obvious...
[Question 1] Backtesting for futures strategies like trend following (which typically work with average indicator like MA / EMA) is usually done on continuous future. As far as i understand, continuous futures time series have to be build outside of RightEdge or through a bespoke historical data retriever. Can someone confirm my understanding?

[Question 2] My second question is about backtesting strategies that require actual future contracts (e.g. typical case would be calendar spread). How would you go about implementing such a strategy in RightEdge? I can include all the actual future contracts as symbol when running my backtest but how do i determine which actual contract is the #1 or #2 contract depending on a given date and some predetermined roll-over rules, or more precisely how do i implement my strategy class since RightEdge work at the actual contract level rather at the meta level. One thing i like about RightEdge is that it is quite flexible/customizable; therefore, this can probably be done in a number of ways. Does anybody has experience with this? on pros/cons of various approaches?

Many thanks in advance.

Edited: Tuesday August 08 2017 by lampalork
Supreme Being (329 reputation)Supreme Being (329 reputation)Supreme Being (329 reputation)Supreme Being (329 reputation)Supreme Being (329 reputation)Supreme Being (329 reputation)Supreme Being (329 reputation)Supreme Being (329 reputation)Supreme Being (329 reputation)
Posted Thursday August 10 2017
[1] My understanding is that RE does not have built-in logic for deriving continuous futures series. So yes, your understanding is correct. You build your data series and implement the appropriate data interfaces to use your data in RE.

[2] Not sure I understand. If, by actual futures contracts, you mean a futures curve going out a few months or years, then each futures contract will have its own data series and can be charted/used as an outright series for each contract month. Spreads can have their own data series too. Looks like you are talking about building your own synthetic spreads data using 2 outright series. You may not have to do that if your data provider feed contains spreads data from the exchange. If you are talking about spreads that are not traded on the exchange or if your data provider does not provide spreads data, you will have to build your own and use a naming convention for each spread to identify it, something like [Futures Symbol][MonthYear1]-[Futures Symbol][MonthYear2]. In your watchlist, you can have separate folders for outrights and spreads.
Posted Thursday August 10 2017
thanks for getting back.
Reading again my question 2, i was not really clear. In my case, spreads are not quoted therefore i have to calculate the series myself. my spread would be something like Front Contract (read 1st future contract) - Back contract (read 2nd future contract). this is not too difficult to implement but it gets slightly more tricky when you start using roll-over rules like (roll 5 days before expiry or roll when volume of 2nd contract is larger than volume of 1st contract). I have implemented something that does the job, i'm basically keeping track of the front month future in the TradingSystem class. For now, it does the job although there might be more elegant way to achieving this. i have attached the class in case this can be usefull to someone else.


Attachments (136 views, 2.00 KB)

Similar Topics

Reading This Topic

2005-2019 © RightEdge Systems