ZigZag...
ZigZag...
29 Aug 2016, 20:18
Sooo....
I am testing a sort of bot to print out values from a zigzag indicator.
I get the previous value and the current (in progress) value from the indicator like this:
ZigZag zigzag;
____________START:_______________________
zigzag = Indicators.GetIndicator<ZigZag>(28, 5, 3);
_________________________________________
var lastValue = GetZigZagValue(zigzag.Result, 0);
var previousValue = GetZigZagValue(zigzag.Result, 1);
_________________________________________
double GetZigZagValue(DataSeries dataSeries, int indexFromEnd)
{
for (var i = MarketSeries.Close.Count - 1; i >= 0; i--)
{
if (!double.IsNaN(zigzag.Result[i]))
{
if (indexFromEnd == 0)
return zigzag.Result[i];
indexFromEnd--;
}
}
return double.NaN;
}
_____________________________________
Main Question:
How can I get the number of bars between those two points (and for example print them to log)?
And thanks a lot for your answer :)