- ago
Hi, is there a way to convert timeseries and/or indicator to <T> List? For example, convert the Close price or in the case of ZigZag, the peaks/throughs.
0
356
Solved
6 Replies

Reply

Bookmark

Sort
Cone8
 ( 24.80% )
- ago
#1
foreach.. add the values that aren't NaNs to the List.
0
- ago
#2
If you reference System.Linq then you have the luxury of ToList..

#using System.Linq;

...

var myList = bars.Close.Values.ToList();
0
Best Answer
Cone8
 ( 24.80% )
- ago
#3
If you want to include all the NaNs of a ZigZag series, Values is already a List<double> and you don't even need Linq.
0
- ago
#4
Just to add to Cone's reply, here's how you can filter them out using Linq:
CODE:
using System.Linq; ... var _ptc = new PeakTroughCalculator(bars, pct, PeakTroughReversalType.Percent); var _zz = new ZigZagHL(bars, pct, PeakTroughReversalType.Percent, false); var nanfree = _zz.Values.ToList().Where(v => !Double.IsNaN(v));
0
- ago
#5
I goofed. bars.Close.Values is already a List<double>.
0
- ago
#6
Thanks to everyone!
0

Reply

Bookmark

Sort