Forward bias in daily data

I'm working on my first algorithm based upon the VIX/VXY ratios in the samples from this thread:

I have the data pulling in properly however it appears that there is forward bias in executing the trades during backtesting. For example, the algorithm fires a sell signal based on end of day data on 1/26 and issues a market on open order but that order is filled based upon opening prices on 1/26. I changed the frequency for the custom data import to daily and also modified the time property for the custom data to be at 5 PM as opposed to 00:00. Both the log entries for my slice events and the trade history shows the events occurring at 5 PM.

Any assistance / observations about using daily custom data in a backtesting scenario would be greatly appreciated!

Update Backtest

Could it be related to the use of fillforward for fills?

Actually, I think I figured it out after trying the fillDataForward to False (which had no effect); I had the resolution for both my equities and my custom data set to daily based upon the sample code that I was borrowing from. I removed the daily resolution specification from the equity which is being bought/sold but left it in there for the custom data and the trades then executed at the market open price on the subsequent day following the signal.

I'm not sure if this is the correct solution as I would have thought that disabling the forward fill would prevent filling with previous days data. Could possibly have something to do with time zone / UTC?


Update Backtest


The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


This discussion is closed