Hi, I'm new to QC and have some basic questions. I coded a simple strategy that aims to buy when a SMA crosses over the price and sell the other way, I played with the optimizer and the code with SPY, it wasn't a great strategy but seemed to work fine. After that I just changed to AAPL and the results are horrible, I even tried optimizing but it didn't work either. I just want to confirm if it is a horrible strategy or if something is wrong with the code. Thanks! I leave both examples below.
Also, I tried to make tolerance a parameter and optimize it but just got errors when optimizing. Any Ideas?
Renata
Here the other backtest.
And another question, when backtesting sometimes the plots don't show the complete SMA for the full period of the price, I debugged and everything seems fine, any ideas?
Varad Kabade
Hi Renata,
We reviewed your code, and we think the implementation and strategy match. To resolve the Optimizer issue, we recommend casting the tolerance to float after retrieving it Using GetParamter. Here we have attached the Summary of the Optimizer as the image as well as the backtest. Moving forward, we recommend going through the following docs regarding the charting limitation. Note that we think the results are "horrible" because this is a momentum strategy, so the results won't be good, independently of the parameter, if the stock is not trending up or down.
Best,
Varad Kabade
Vladimir
Renata,
--> the plots don't show the complete SMA for the full period of the price,
There is 4000 limit for chart data points.
So, if you run the backtest from 01-01-2007, you will see all the charts in full.
--> Any Ideas?
I would flip the trading logic and increase the "length" to, say, 100.
Renata
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!