Back

Default Stockplot is not accurate: close price is shifted one day forward

Hi experts,

Please feel free to point me to an existing post/answer for my question. 

I found that the default Stockplot is not accurate with one-day shifted close prices. For example, I built a sample algo that buys and sells SPY based on daily change. I have a custom plot for OHLC for comparison.

As you can see in my sample below, in the default Stockplot, the close price on Apr 18 2018 doesn't match with my custom plot (purely OHLC). In the default Stockplot, the close price $267.65 on Apr 18 is in fact the close price of Apr 19, hence it's shifted one day forward.

Does anyone know why?

Update Backtest








When using daily resolution, the TradeBar data references the day before's OHLC prices because that was the last complete TradeBar. And because this is the data in the algorithm, there will be a one day shift forward. Hence, the stockplot above is showing the expected behavior. Most plotting websites show bars as points without a period, whereas in QuantConnect all our data also has an associated period.

0

Update Backtest





0

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.


Loading...

This discussion is closed