I would like to create a data series containing the higher of the Open or Close.
CODE:
Please log in to see this code.
throws an error. Is there a way it can be done with a DataSeries Object?
Size:
Color:
That's because Math.Max accepts two numbers, not two DataSeries. Try this:
CODE:
Please log in to see this code.
Size:
Color:
Thanks Eugene. I thought this might be one of those times when you have much simpler way to code something than the way I would do it.
Size:
Color:
Well, with extension methods you can make it a one-liner. Still, you'd have to put that DataSeriesEx class somewhere (btw, one already exists in Community Components, providing access to methods like "DataSeries.ToList"). But then you use ".HighestOfTwo" as a native WealthScript method and don't even need a "
using" directive:
CODE:
Please log in to see this code.
I think it makes sense to add HighestOfTwo and its opposite LowestOfTwo to C.Components.
Size:
Color:
HighestOfTwo and LowestOfTwo have been added to Community Components 2016.03.
Size:
Color: