One the symbols used in my strategy causes a Runtime Error
Author: rmandel00
Creation Date: 10/27/2017 3:05 AM
profile picture


The first line of the message is
Cannot plot a dataseries that contains infinity
The next three lines specify the functions that are not running correctly.

The symbol is a Vanguard mutual fund. If I substitute an equivalent ETF for the mutual fund, the program runs and gives results. I assume there is an error in the data for the symbol and I tried to delete and reupdate it but it still doesn't run. I am running the program from 2007. If I run it from 2013 to the present the program runs. So apparently there is a problem with the data.

I have fouind the exact date before which the program doesn't run. How can I correct the data points?
Rich Man
profile picture



At first, let's have a look at your Strategy code that generates the error. It's okay to see a "cleaned up" version of it that covers the DataSeries creation, building and plotting - no need to see its buy/sell logic. Please also tell me the symbol, the data scale, and the exact data loading range. I'll be trying to reproduce it on Yahoo! data and to offer correction to your code which might be made more robust.
profile picture


Thanks for your offer. I began to clean up the code to make it more readable and then commented out some of the plotseries. I found that plotting the sharpe ratio (roc/stddev) of that Vanguard mutual fund is what blows up the program giving me a runtime error. If I don't plot the series the program runs and gives me good results. The standard deviation in the denominator was blowing up the plot. If I add a small number (0.001) to the denominator the program runs and plots normally.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).