Unable to cast object error
Author: Darrell__
Creation Date: 1/12/2017 1:34 AM
profile picture

Darrell__

#1
I get a run time error If I use the the following indicator in a script:
CODE:
Please log in to see this code.

The script compiles fine, but the following Runtime error is generated, i.e. "Unable to cast object of type 'TASCIndicators.FastSMA' to type 'Community.Indicators.FastSMA'.

What is very unusual about this error, is that if I use any Lookback period, other than 5, in the Correlation series the indicator works fine, but if I use a Lookback period of 5 I get a run time error. Also, if I use a basic bar series, i.e. open, high, low, or close, and a lookback period of 5 the indicator also works.

profile picture

Eugene

#2
The type FastSMA appears in both TASCIndicators and Community.Indicators namespaces. If your script refers to both of them there may be a conflict because of the way the Correlation in C.Indicators is currently using the FastSMA.

I will fix this potential ambiguity in a new build of C.Indicators (shortly). If you need a quick fix, you might want to provide a more complete example script sufficient to demonstrate the anomaly since it was impossible to reproduce the error using just the code line alone.
profile picture

Darrell__

#3
It took me awhile to recreate the error, but try the following:

CODE:
Please log in to see this code.

I don't really need a quick fix, I'll just wait for the next update.
profile picture

Eugene

#4
Since your code uses indicators found in both TASCIndicators and Community.Indicators together, I'm afraid a quick fix isn't possible. There's a DataSeries description conflict between the two FastSMA in Bars.Cache. The update to both libraries is in the works.
profile picture

Darrell__

#5
No worries... I can wait. By the way, Wealth-Lab Pro is a great software program. I've tried most of the other programs, but the more I use Wealth-Lab the more I like it. Your program reminds me of another program I used almost 20 years ago which is no longer in service called TechniFilter Plus, albeit your software is light years more advanced.
profile picture

Eugene

#6
Thank you for your kind words, much appreciated.
profile picture

Eugene

#7
Darrell, the bug is fixed. Please update Community Indicators to v2017.02 using the Extension Manager.