Convert DataSeries to C# Array
Author: Mockasino
Creation Date: 12/28/2016 11:08 AM
profile picture

Mockasino

#1
Hello,

i am not sure if this is the right place to post this question.:

How can i "move" a WL-Dataseries (e.g. RSI.Series) to a C#' multidimensional Array (e.g. double [ ][ ]) and back?
I would like to perform some mathematical functions which require a double Array as Input.

Regards
Christian
profile picture

Eugene

#2
Christian, there are helper functions in Community Components for .ToList/.ToArray conversion:

DataSeries.ToList
profile picture

Mockasino

#3
Perfect! Thanks.
Sorry, this is what i should have seen myself.
profile picture

Eugene

#4
No problem, glad to help. By the way, just documented ToArray to make it more visible in the Wiki:

DataSeries.ToArray
profile picture

Mockasino

#5
What do i have to do to be able to use it in the Neuro-Lab Input-Strategy?
I put the System.Core.dll in the WL-Folder, but this does not help.
profile picture

Eugene

#6
Help what? Please clarify the problem.
profile picture

Mockasino

#7
I would like to use the .To Array() Function in an Input script in Neuro-Lab.
But i could not. i dont get it compiled.
In a normal strategy code it is working.
profile picture

Eugene

#8
Example below compiles successfully and does not require System.Core.dll to be put in the WLD main folder. Is there a chance to know the compiler error message you're having or is it a secret you're trying to keep? ;)

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

Mockasino

#9
The german error message translated is like " Object was not determined to object instance"

here is the coding:

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

Mockasino

#10
Sorry, now it is working.
profile picture

Eugene

#11
Good for you, and sometimes restarting WLD may help in such cases.
profile picture

Mockasino

#12
Now hopefully my last question on this topic:-)

How do i perform the other way round?
After i have manipulated the array, i would like to put back the result to a Dataseries ,
profile picture

Eugene

#13
In general it goes like this. In a loop by each bar, read your array's values and assign the current value to the current bar.
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).