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.
Rename
foreach.. add the values that aren't NaNs to the List.
If you reference System.Linq then you have the luxury of ToList..
#using System.Linq;
...
var myList = bars.Close.Values.ToList();
#using System.Linq;
...
var myList = bars.Close.Values.ToList();
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.
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));
I goofed. bars.Close.Values is already a List<double>.
Thanks to everyone!
Your Response
Post
Edit Post
Login is required