DSS indicator: runtime error "Cannot plot a DataSeries that contains Infinity"
Author: Eugene
Creation Date: 11/16/2019 5:47 AM
profile picture

sjendoubi

#1
Hi Every One:

I was able to plot DSS.Series(Bars,9,5,m) for m<=10. For m>10 I got the Runtime Error Message in the attached Picture.
Any Idea About this?


Thanks

profile picture

Cone

#2
@sjendoubi
if you could provide a symbol, timeframe, and a data range for which this error occurs, we might be able to help out.
profile picture

sjendoubi

#3
Cone,

Try this code for any symbol and for the daily timeframe.

Thanks


CODE:
Please log in to see this code.
profile picture

Eugene

#4
The problem with your code is the choice of 2nd EMA period which appears to be shorter than the 1st EMA. Compare the Wiki example...
CODE:
Please log in to see this code.

...with your code line that produces the error:
CODE:
Please log in to see this code.

I don't know if there's rational sense in this choice of lookback but as soon as the EMA2 period becomes greater than EMA1+2, the error message disappears. Although I can't tell if this behavior is intended to alert you about an incorrect value of the DataSeries or is a code bug, you can work around it by creating a custom DSS and dropping all values that contain Infinity. Check this out:

CODE:
Please log in to see this code.


P.S. Slah, here's regarding topic choice when posting in existing forum threads. The thread you posted this was called "Runtime error with DataSeries which sums up/down days in a period". But neither the indicator used (DSS) nor original poster's error message had in common with your problem.

WL can throw different kinds of runtime error. Usually, topic titles may contain them. If nothing appears on your search for e.g. "Infinity" then starting a new topic (like I just did and moved your post to) presents a better alternative and lets other users find it. But if posted the way you did it then it could not be found using forum's topic title search.

Thanks.
profile picture

sjendoubi

#5
Thank You Eugene!!!

It Works. However, where do infinity come from? We are dealing with averages here.
profile picture

Eugene

#6
QUOTE:
It Works. However from infinity comes from?

You're welcome. It comes from accessing some values prematurely inside the DSS code. Clearly it's a bug.
profile picture

sjendoubi

#7
Is any one going to fix this bug?
profile picture

Eugene

#8
It's just discovered on a weekend. No one knows yet. Given the discovery has happened after over a decade of WLP usage and the fact that it affects just one use case when Stoch period is greater than EMA1/EMA2 period, I wouldn't doubt that it's a low priority. I've just added it to our Open Issues list.

For now you have two workarounds:

1. Don't use a Stoch period greater than EMA1/EMA2 period
2. Use code from post #4 above
profile picture

Eugene

#9
Should be fixed in the next build.
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).