When using CSI futures data, RealTest is able to backtest strategies and generate trading orders from back-adjusted continuous contract series.
As with Norgate futures data, RealTest also fully supports backtesting on the individual contracts with CSI data, as described here and shown in example scripts such as futures_volume_rank.rts.
For most use cases, it will prove to be simpler and just as effective to only import the XX_B (back adjusted continuous) symbols when using CSI.
CSI provides a wide array of options for how to model the rolls from one contract to the next when stitching individual contracts together into a continuous contract.
Among other choices, CSI supports proportional (ratio) adjustment and forward adjustment. These are NOT recommended for use with RealTest. Choose one of the difference-based back-adjusted approaches. The default settings in CSI's portfolio manager are a great place to start. See CSI Futures Import for further details.
As shown below for the VX futures continuous contract series, the bar data is back adjusted and also includes the unadjusted closes in Extra and the contract expiry dates in InfoExpiry:
.png)
RealTest has no problem handling the negative prices that will sometimes result from difference-based back adjustment. The key point is that the daily price movement, in points, remains unaffected by the adjustments (except on roll dates, when the price change from the prior day accurately reflects the difference between the two contracts involved in the roll).
Here's a market that, opposite to VX, tends to be in backwardation rather than contango:
.png)
Here is a trade example that illustrates this point:
.png)
The key stats in the trade record are Points and Profit. In contrast to those for stocks and ETFs, futures strategies generally do not use any type of calculations involving percent change of price in their trading rules or stats, nor multiples of price in their position sizing. Instead, these calculations focus on points of movement, PointValue, and point-based indicators such as ATR.
See below for the entire script of the strategy that made this trade.
When CSI continuous contract data is used with RealTest, roll costs can optionally be calculated using the RollCost strategy formula. RealTest knows when CSI has implemented each roll, because each continuous contract data series includes the expiry date of the current contract as of each bar. When RollCost is specified, the formula is evaluated on each roll date and the amount that it returns is subtracted from the net profit of the trade.
Add a T.RollCosts column to your Trades.rts to see the total roll costs for each trade in your trade lists. Add a S.RollCosts graph to your Graphs.rts to see the daily total roll costs applied to trades exiting that day. Add a formula with Sum(S.RollCosts, S.Number) to your Results.rts to show that figure as a column in your results windows.
When using continuous contract data, the symbols shown in your trade list will be the continuous contract symbol, e.g. ES_B for E-mini S&P 500.
If you enable the Test Details Log, you will see the entry, exit, and roll transactions logged using the individual contract symbols that would have been traded:
.png)
When you generate orders, they will also use the correct individual contract symbols. Text orders will use symbols like the ones in the log output above.
When generating CSV orders, you can use the example exchangemap_csi.csv file as your ExchangeMap, and the example ibfutures_csi.csv file as your SymChangeList:
.png)
This will ensure that your generated orders can actually be placed and executed in your Interactive Brokers account:
.png)
(If you use a different broker that also accepts CSV order lists, you can modify your OrdersTemplate and the above two files as needed.)
The example script futures_trend_follow_csi.rts shows a complete long/short trend following strategy implementation:
.png)
|