Can data type objects other than DataSeries be Synchronized?
Author: KEVINP
Creation Date: 10/2/2015 11:13 PM
profile picture

KEVINP

#1
Hello all,

I declared an object of type "MACDEx_Histogram" using the Community.Indicators library. This instantiation was after the SetScaleCompressed method. RestoreScale followed fourth. I then attempted to Synchronize the MACDEx_Histogram object. Doing this created a compile time error:

QUOTE:
warning CS1685 @ (0,0) : The predefined type 'System.Threading.Tasks.Task' is defined in multiple assemblies in the global alias; using definition from 'c:\Windows\Microsoft.NET\Framework\v4.030319\mscorlib.dll'

error CS0266 @ (25, 29) : Cannot implicitly convert type 'WealthLab.DataSeries' to 'Community.Indicators.MACDEx_Histogram'. An explicit conversion exists (are you missing a cast?)


Here is the code:

CODE:
Please log in to see this code.


Regarding the object in question, if I change the object's data type to DataSeries, the code then compiles and I am on my way.

My questions are:

1. Does object MACDEx_Histogram derive from the DataSeries class ?

1b. If object MACDEx_Histogram does derive from the DataSeries class, why is it not synchronizable ?

2. Is there a way to cast, convert, or some other trick with the synchronize function for the code to compile successfully (without changing to the DataSeries object) ?

3. According to the programming guide, the professional method is to use the specific object types for each indicator. If these specific object types are not synchronizable, then what gives ?

4. Are there any other details I am missing ?


Thank you for the help.
profile picture

Eugene

#2
This is not a trick. Just keep in mind that if you define a DataSeries within a SetScaleCompressed block, you define it as DataSeries explicitly. As an alternative, you can define it before the block; even if it's a "var" WL should sort it out:

CODE:
Please log in to see this code.
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).