Back

Issues with the moving averages on the VIX index.

This project doesn't make any trades because it keeps defualting to the else statement at the end. Even though the price is not equal to the moving average of the index. Why is it doing this, Im not having trouble with other etfs, and ive tried multiple resolutions and it didn't make a difference.

Update Backtest








There are a few things in your algorithm:

1) "VIX" is not a valid ETF ticker. If you want to trade the VIX ETF, the ticker should be "VXX".

2)  Indicators are not ready when you first create them. The length of time it takes to warm up depends on the indicator period. To use the indicator in the algorithm, you need to initialize the indicator with self.SetWarmUp(period). Please check out this example.

3) self.vix.Price is incorrect. To get the current asset price, you can use self.Securities[symbol].Price. 

4) You only request the Daily data of "SPXL" with self.AddEquity("SPXL", Resolution.Daily). You should use the minute resolution here. Otherwise, when you place the market order, all orders will be converted to the MaketOnOpen() because of missing minute price data. You can still use the daily resolution when creating the SPXL indicator. 

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.


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