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.
Size:
Color:
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.
Size:
Color:
For printing somewhere, you can start from the Debug window: PrintDebug. QuickRef for more (hit F11).
Size:
Color:
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
Size:
Color:
I figured it out: Bars.Count-1 and the compiler error goes away.
Thanks much
K
Size:
Color:
Oops, you're right - I should've been more attentive to the word "screener". Bars.Count-1 is the way to go.
Size:
Color: