Back

Where am I going wrong?

I've written legal code, but for some reason its not making any trades. I am new and very lost, does anyone know what causes this type of runtime error? Any help would be greatly apprecitated, thank you for your time. 

Update Backtest








Hey John,

You have syntax errors when calling your indicators, instead of putting self.sma20vix, you have to put self.sma20vix.Current.Value.

After fixing that, it still makes no trades because there is no situation where self.sma20vix.Current.Value > or < self.sma10vix.Current.Value. I changed ">" to "==" and it works. You might want to have a look at the daily resolution VIX data.

1


Thank you so much for your help!

0

Why does it think that they are equal values? They should not be equal to each other. 

0

The reason as to why the self.sma20vix.Current.Value and self.sma10vix.Current.Value values were equal was actually because the values were 0. This was because the wrong data was being fed into the self.SMA helper method. "VIX" is the symbol for the option security, as seen in the Data Explorer, and the SMA was not being fed the proper data. In order to get the code to run, I substituted "VIX" with "VIXH", an ETF. Once this change was made, the SMA's were properly calculated. Feel free to use the Data Explorer and figure out the proper asset to use for determining the trading signals.

There were a few minor edits needed for the algorithm to work, but it is now running below. Good luck!

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