Hi,
I copied tutorial code from https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/MACDTrendAlgorithm.py to try out the MACD strategy. However in the backtest result I noticed that there's an order on 2018-02-27 that bought SPY at price $259.471818697. However looking at other data providers (e.g. Yahoo finance, TradingView) the SPY price on that day should be around $274, which is very far from the $259 backtest price. Could you help me understand what's going on here? Thanks!
Best,
Richard
Fred Painchaud
Hi Richard,
It looks like an error in the data, indeed.
Would you please report it here:
https://www.quantconnect.com/data/issues/open
Thanks!
Fred
Richard C
Hi Fred,
I emailed QuantConnect support and they said that the prices I mentioned in Yahoo finance are raw prices while my algorithm is using adjusted prices. I checked Yahoo finance again and indeed the adjusted prices is around $256, which looks correct to me.
FYI, here's their reply:
“”"
The prices that you have mentioned are raw prices while your algorithm is using adjusted prices. Please look at the row of Yahoo on Jan 27th, 2018:
Feb 27, 2018 278.11 278.92 274.36 274.43 256.05
the last column is the adjusted price, so we can see a factor of 0.93302 (=256.05/274.43).
If we adjust the prices, we will have:
Feb 27, 2018 259.48 260.24 255.98 256.05 256.05
so the fill price of 259.47 falls inside that range.
This information can be found in Initializing Algorithms: Selecting Asset Data section of the docs. The data normalization mode was also discussed on BootCamp: Set Data Normalization Mode.
“”"
Richard C
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!