Cannot implicitly convert type 'WealthLab.Indicators.ROC' to 'double'
Author: KevinA
Creation Date: 5/20/2012 2:34 AM
profile picture

KevinA

#1
I'm new to C# and WLP so I'd appreciate some help here in figuring this out...

I'm trying to code a simple screener, sorting the dataset by the highest ROC and then dumping the sorted list of symbols and their corresponding ROC values ... somewhere. I haven't gotten to the somewhere part yet as I'm stuck when I try to use ROC.Series to assign its computed value to the pointer holder.roc. The compiler gives me this error msg: error CS0029 @ (47,19): Cannot implicitly convert type 'WealthLab.Indicators.ROC' to 'double'. I understand the msg, I just don't know what to do despite having read everything I can reasonably find on this site and the programming guide about screeners.

I used the Symbol Rotation code as the basis for this. Any help would be appreciated. Thanks.

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

Eugene

#2
Welcome to the community forums.

To get rid of the error you probably need to change this line...
CODE:
Please log in to see this code.
...this way:
CODE:
Please log in to see this code.
profile picture

Eugene

#3
For printing somewhere, you can start from the Debug window: PrintDebug. QuickRef for more (hit F11).
profile picture

KevinA

#4
Now that's what I call service ... at 3am in the morning :)

I deleted the '[bar]' from the original code which still works in the full backtest version. In this version, there was no need for it but I think you are suggesting I use a for loop instead of foreach and using a counter called bar ? I don't need it to calculate ROC for all the bars, just the most current or recent one when the script is run.

Thanks very much for the response
K
profile picture

KevinA

#5
I figured it out: Bars.Count-1 and the compiler error goes away.

Thanks much
K
profile picture

Eugene

#6
Oops, you're right - I should've been more attentive to the word "screener". Bars.Count-1 is the way to go.
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).