I feel fairly confident this is a question that has been asked and answered, but it proved difficult to find in the forum.
I currently have a for-loop that copies a range of values from a VariableSeries object to a C# array. That works fine, but it is cumbersome and suboptimal. Is there a simpler method for doing this in a single command?
For simplicity, I'd simply like to take the most recent 50 values from a VariableSeries and copy them into a double array.
Much thanks,
Matt
Transfer multiple values from VariableSeries object to C# array [SOLVED]
-
- Posts: 3
- Joined: 14 Sep 2018
- Has thanked: 1 time
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Transfer multiple values from VariableSeries object to C# array
Hello Matt,
There's no prebuilt method for that.
There's no prebuilt method for that.
- fbertram
- Posts: 166
- Joined: 16 Oct 2014
- Location: Seattle, USA
- Has thanked: 36 times
- Been thanked: 76 times
- Contact:
Re: Transfer multiple values from VariableSeries object to C# array [SOLVED]
You can use Linq to do what you need. Try something along the lines of this:
Hope this helps,
cheers
Felix
Code: Select all
double[] myArray = Enumerable.Range(0, 25)
.Select(t => Bars.Close[t])
.ToArray();
Hope this helps,
cheers
Felix